Sha256: 184c00c87d7202452570dfaba1bf2ce575090c033ee25b8135cadaa2ad744ff3

Contents?: true

Size: 492 Bytes

Versions: 2

Compression:

Stored size: 492 Bytes

Contents

'use strict';
module.exports = function (str) {
	return str.replace(/(?:\\*)?"([^"\\]*\\.)*[^"]*"/g, function (match) {
		return match
			// unescape double-quotes
			.replace(/([^\\]|^)\\"/g, '$1"')
			// escape escapes
			.replace(/(^|[^\\])(\\+)'/g, '$1$2\\\'')
			// escape single-quotes - round 1
			.replace(/([^\\])'/g, '$1\\\'')
			// escape single-quotes - round 2 (for consecutive single-quotes)
			.replace(/([^\\])'/g, '$1\\\'')
			// convert
			.replace(/^"|"$/g, '\'');
	});
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/to-single-quotes/index.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/to-single-quotes/index.js