From d10b44bdef2b735865c493fbaec8687ec8998aef Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 8 Apr 2017 22:41:48 -0700 Subject: [PATCH] Adjust spacing in template string expressions. --- .internal/arrayLikeKeys.js | 2 +- .internal/baseMerge.js | 2 +- .internal/baseMergeDeep.js | 2 +- .internal/baseToString.js | 4 ++-- .internal/createRound.js | 8 ++++---- .internal/equalByTag.js | 2 +- .internal/getTag.js | 12 +++++------ .internal/hasUnicode.js | 2 +- .internal/toKey.js | 2 +- .internal/unicodeSize.js | 20 +++++++++---------- .internal/unicodeToArray.js | 20 +++++++++---------- .internal/unicodeWords.js | 40 ++++++++++++++++++------------------- camelCase.js | 2 +- deburr.js | 2 +- invertBy.js | 2 +- kebabCase.js | 2 +- lowerCase.js | 2 +- parseInt.js | 2 +- random.js | 4 ++-- replace.js | 2 +- snakeCase.js | 2 +- startCase.js | 2 +- startsWith.js | 2 +- template.js | 28 +++++++++++++------------- toNumber.js | 2 +- toString.js | 4 ++-- truncate.js | 2 +- uniqueId.js | 2 +- upperCase.js | 2 +- 29 files changed, 90 insertions(+), 90 deletions(-) diff --git a/.internal/arrayLikeKeys.js b/.internal/arrayLikeKeys.js index d0f3a742e..62f924333 100644 --- a/.internal/arrayLikeKeys.js +++ b/.internal/arrayLikeKeys.js @@ -24,7 +24,7 @@ function arrayLikeKeys(value, inherited) { const result = new Array(skipIndexes ? length : 0) let index = skipIndexes ? -1 : length while (++index < length) { - result[index] = `${ index }` + result[index] = `${index}` } for (const key in value) { if ((inherited || hasOwnProperty.call(value, key)) && diff --git a/.internal/baseMerge.js b/.internal/baseMerge.js index 1d09c8ccc..1efccedb9 100644 --- a/.internal/baseMerge.js +++ b/.internal/baseMerge.js @@ -27,7 +27,7 @@ function baseMerge(object, source, srcIndex, customizer, stack) { } else { let newValue = customizer - ? customizer(object[key], srcValue, `${ key }`, object, source, stack) + ? customizer(object[key], srcValue, `${key}`, object, source, stack) : undefined if (newValue === undefined) { diff --git a/.internal/baseMergeDeep.js b/.internal/baseMergeDeep.js index 23a289bbd..b2e4e9764 100644 --- a/.internal/baseMergeDeep.js +++ b/.internal/baseMergeDeep.js @@ -36,7 +36,7 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta return } let newValue = customizer - ? customizer(objValue, srcValue, `${ key }`, object, source, stack) + ? customizer(objValue, srcValue, `${key}`, object, source, stack) : undefined let isCommon = newValue === undefined diff --git a/.internal/baseToString.js b/.internal/baseToString.js index c061a10d8..79e3eab13 100644 --- a/.internal/baseToString.js +++ b/.internal/baseToString.js @@ -22,12 +22,12 @@ function baseToString(value) { } if (Array.isArray(value)) { // Recursively convert values (susceptible to call stack limits). - return `${ value.map(baseToString) }` + return `${value.map(baseToString)}` } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : '' } - const result = `${ value }` + const result = `${value}` return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result } diff --git a/.internal/createRound.js b/.internal/createRound.js index 28708cffa..043b6a727 100644 --- a/.internal/createRound.js +++ b/.internal/createRound.js @@ -12,11 +12,11 @@ function createRound(methodName) { if (precision) { // Shift with exponential notation to avoid floating-point issues. // See [MDN](https://mdn.io/round#Examples) for more details. - let pair = `${ number }e`.split('e') - const value = func(`${ pair[0] }e${ +pair[1] + precision }`) + let pair = `${number}e`.split('e') + const value = func(`${pair[0]}e${ +pair[1] + precision }`) - pair = `${ value }e`.split('e') - return +`${ pair[0] }e${ +pair[1] - precision }` + pair = `${value}e`.split('e') + return +`${pair[0]}e${+pair[1] - precision}` } return func(number) } diff --git a/.internal/equalByTag.js b/.internal/equalByTag.js index 204cb4067..de5f7a532 100644 --- a/.internal/equalByTag.js +++ b/.internal/equalByTag.js @@ -74,7 +74,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { // Coerce regexes to strings and treat strings, primitives and objects, // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring // for more details. - return object == `${ other }` + return object == `${other}` case mapTag: let convert = mapToArray diff --git a/.internal/getTag.js b/.internal/getTag.js index 2511ee0b0..d43709d49 100644 --- a/.internal/getTag.js +++ b/.internal/getTag.js @@ -9,11 +9,11 @@ const setTag = '[object Set]' const weakMapTag = '[object WeakMap]' /** Used to detect maps, sets, and weakmaps. */ -const dataViewCtorString = `${ DataView }` -const mapCtorString = `${ Map }` -const promiseCtorString = `${ Promise }` -const setCtorString = `${ Set }` -const weakMapCtorString = `${ WeakMap }` +const dataViewCtorString = `${DataView}` +const mapCtorString = `${Map}` +const promiseCtorString = `${Promise}` +const setCtorString = `${Set}` +const weakMapCtorString = `${WeakMap}` /** * Gets the `toStringTag` of `value`. @@ -33,7 +33,7 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || getTag = (value) => { const result = baseGetTag(value) const Ctor = result == objectTag ? value.constructor : undefined - const ctorString = Ctor ? `${ Ctor }` : '' + const ctorString = Ctor ? `${Ctor}` : '' if (ctorString) { switch (ctorString) { diff --git a/.internal/hasUnicode.js b/.internal/hasUnicode.js index a7ead5688..ce536cc97 100644 --- a/.internal/hasUnicode.js +++ b/.internal/hasUnicode.js @@ -10,7 +10,7 @@ const rsVarRange = '\\ufe0e\\ufe0f' const rsZWJ = '\\u200d' /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ -const reHasUnicode = RegExp(`[${ rsZWJ + rsAstralRange + rsComboRange + rsVarRange }]`) +const reHasUnicode = RegExp(`[${rsZWJ + rsAstralRange + rsComboRange + rsVarRange}]`) /** * Checks if `string` contains Unicode symbols. diff --git a/.internal/toKey.js b/.internal/toKey.js index 8faf05f0f..e4ce9958d 100644 --- a/.internal/toKey.js +++ b/.internal/toKey.js @@ -14,7 +14,7 @@ function toKey(value) { if (typeof value == 'string' || isSymbol(value)) { return value } - const result = `${ value }` + const result = `${value}` return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result } diff --git a/.internal/unicodeSize.js b/.internal/unicodeSize.js index e759e9b3f..fa7515dfa 100644 --- a/.internal/unicodeSize.js +++ b/.internal/unicodeSize.js @@ -7,25 +7,25 @@ const rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsR const rsVarRange = '\\ufe0e\\ufe0f' /** Used to compose unicode capture groups. */ -const rsAstral = `[${ rsAstralRange }]` -const rsCombo = `[${ rsComboRange }]` +const rsAstral = `[${rsAstralRange}]` +const rsCombo = `[${rsComboRange}]` const rsFitz = '\\ud83c[\\udffb-\\udfff]' -const rsModifier = `(?:${ rsCombo }|${ rsFitz })` -const rsNonAstral = `[^${ rsAstralRange }]` +const rsModifier = `(?:${rsCombo}|${rsFitz})` +const rsNonAstral = `[^${rsAstralRange}]` const rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}' const rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]' const rsZWJ = '\\u200d' /** Used to compose unicode regexes. */ -const reOptMod = `${ rsModifier }?` -const rsOptVar = `[${ rsVarRange }]?` -const rsOptJoin = `(?:${ rsZWJ }(?:${ [rsNonAstral, rsRegional, rsSurrPair].join('|') })${ rsOptVar + reOptMod })*` +const reOptMod = `${rsModifier}?` +const rsOptVar = `[${rsVarRange}]?` +const rsOptJoin = `(?:${rsZWJ}(?:${[rsNonAstral, rsRegional, rsSurrPair].join('|')})${rsOptVar + reOptMod})*` const rsSeq = rsOptVar + reOptMod + rsOptJoin -const rsNonAstralCombo = `${ rsNonAstral }${ rsCombo }?` -const rsSymbol = `(?:${ [rsNonAstralCombo, rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') })` +const rsNonAstralCombo = `${rsNonAstral}${rsCombo}?` +const rsSymbol = `(?:${[rsNonAstralCombo, rsCombo, rsRegional, rsSurrPair, rsAstral].join('|')})` /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ -const reUnicode = RegExp(`${ rsFitz }(?=${ rsFitz })|${ rsSymbol + rsSeq }`, 'g') +const reUnicode = RegExp(`${rsFitz}(?=${rsFitz})|${rsSymbol + rsSeq}`, 'g') /** * Gets the size of a Unicode `string`. diff --git a/.internal/unicodeToArray.js b/.internal/unicodeToArray.js index 02e3c9aa4..7f825fa55 100644 --- a/.internal/unicodeToArray.js +++ b/.internal/unicodeToArray.js @@ -7,25 +7,25 @@ const rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsR const rsVarRange = '\\ufe0e\\ufe0f' /** Used to compose unicode capture groups. */ -const rsAstral = `[${ rsAstralRange }]` -const rsCombo = `[${ rsComboRange }]` +const rsAstral = `[${rsAstralRange}]` +const rsCombo = `[${rsComboRange}]` const rsFitz = '\\ud83c[\\udffb-\\udfff]' -const rsModifier = `(?:${ rsCombo }|${ rsFitz })` -const rsNonAstral = `[^${ rsAstralRange }]` +const rsModifier = `(?:${rsCombo}|${rsFitz})` +const rsNonAstral = `[^${rsAstralRange}]` const rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}' const rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]' const rsZWJ = '\\u200d' /** Used to compose unicode regexes. */ -const reOptMod = `${ rsModifier }?` -const rsOptVar = `[${ rsVarRange }]?` -const rsOptJoin = `(?:${ rsZWJ }(?:${ [rsNonAstral, rsRegional, rsSurrPair].join('|') })${ rsOptVar + reOptMod })*` +const reOptMod = `${rsModifier}?` +const rsOptVar = `[${rsVarRange}]?` +const rsOptJoin = `(?:${rsZWJ}(?:${[rsNonAstral, rsRegional, rsSurrPair].join('|')})${rsOptVar + reOptMod})*` const rsSeq = rsOptVar + reOptMod + rsOptJoin -const rsNonAstralCombo = `${ rsNonAstral }${ rsCombo }?` -const rsSymbol = `(?:${ [rsNonAstralCombo, rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') })` +const rsNonAstralCombo = `${rsNonAstral}${rsCombo}?` +const rsSymbol = `(?:${[rsNonAstralCombo, rsCombo, rsRegional, rsSurrPair, rsAstral].join('|')})` /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ -const reUnicode = RegExp(`${ rsFitz }(?=${ rsFitz })|${ rsSymbol + rsSeq }`, 'g') +const reUnicode = RegExp(`${rsFitz}(?=${rsFitz})|${rsSymbol + rsSeq}`, 'g') /** * Converts a Unicode `string` to an array. diff --git a/.internal/unicodeWords.js b/.internal/unicodeWords.js index 6a1996617..32dd14dbe 100644 --- a/.internal/unicodeWords.js +++ b/.internal/unicodeWords.js @@ -16,32 +16,32 @@ const rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpa /** Used to compose unicode capture groups. */ const rsApos = "['\u2019]" -const rsBreak = `[${ rsBreakRange }]` -const rsCombo = `[${ rsComboRange }]` +const rsBreak = `[${rsBreakRange}]` +const rsCombo = `[${rsComboRange}]` const rsDigits = '\\d+' -const rsDingbat = `[${ rsDingbatRange }]` -const rsLower = `[${ rsLowerRange }]` -const rsMisc = `[^${ rsAstralRange }${ rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange }]` +const rsDingbat = `[${rsDingbatRange}]` +const rsLower = `[${rsLowerRange}]` +const rsMisc = `[^${rsAstralRange}${rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange}]` const rsFitz = '\\ud83c[\\udffb-\\udfff]' -const rsModifier = `(?:${ rsCombo }|${ rsFitz })` -const rsNonAstral = `[^${ rsAstralRange }]` +const rsModifier = `(?:${rsCombo}|${rsFitz})` +const rsNonAstral = `[^${rsAstralRange}]` const rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}' const rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]' -const rsUpper = `[${ rsUpperRange }]` +const rsUpper = `[${rsUpperRange}]` const rsZWJ = '\\u200d' /** Used to compose unicode regexes. */ -const rsMiscLower = `(?:${ rsLower }|${ rsMisc })` -const rsMiscUpper = `(?:${ rsUpper }|${ rsMisc })` -const rsOptContrLower = `(?:${ rsApos }(?:d|ll|m|re|s|t|ve))?` -const rsOptContrUpper = `(?:${ rsApos }(?:D|LL|M|RE|S|T|VE))?` -const reOptMod = `${ rsModifier }?` -const rsOptVar = `[${ rsVarRange }]?` -const rsOptJoin = `(?:${ rsZWJ }(?:${ [rsNonAstral, rsRegional, rsSurrPair].join('|') })${ rsOptVar + reOptMod })*` +const rsMiscLower = `(?:${rsLower}|${rsMisc})` +const rsMiscUpper = `(?:${rsUpper}|${rsMisc})` +const rsOptContrLower = `(?:${rsApos}(?:d|ll|m|re|s|t|ve))?` +const rsOptContrUpper = `(?:${rsApos}(?:D|LL|M|RE|S|T|VE))?` +const reOptMod = `${rsModifier}?` +const rsOptVar = `[${rsVarRange}]?` +const rsOptJoin = `(?:${rsZWJ}(?:${[rsNonAstral, rsRegional, rsSurrPair].join('|')})${rsOptVar + reOptMod})*` const rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)' const rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)' const rsSeq = rsOptVar + reOptMod + rsOptJoin -const rsEmoji = `(?:${ [rsDingbat, rsRegional, rsSurrPair].join('|') })${ rsSeq }` +const rsEmoji = `(?:${[rsDingbat, rsRegional, rsSurrPair].join('|')})${rsSeq}` /** * Splits a Unicode `string` into an array of its words. @@ -51,10 +51,10 @@ const rsEmoji = `(?:${ [rsDingbat, rsRegional, rsSurrPair].join('|') })${ rsSeq * @returns {Array} Returns the words of `string`. */ const unicodeWords = RegExp.prototype.exec.bind(RegExp([ - `${ rsUpper }?${ rsLower }+${ rsOptContrLower }(?=${ [rsBreak, rsUpper, '$'].join('|') })`, - `${ rsMiscUpper }+${ rsOptContrUpper }(?=${ [rsBreak, rsUpper + rsMiscLower, '$'].join('|') })`, - `${ rsUpper }?${ rsMiscLower }+${ rsOptContrLower }`, - `${ rsUpper }+${ rsOptContrUpper }`, + `${rsUpper}?${rsLower}+${rsOptContrLower}(?=${[rsBreak, rsUpper, '$'].join('|')})`, + `${rsMiscUpper}+${rsOptContrUpper}(?=${[rsBreak, rsUpper + rsMiscLower, '$'].join('|')})`, + `${rsUpper}?${rsMiscLower}+${rsOptContrLower}`, + `${rsUpper}+${rsOptContrUpper}`, rsOrdUpper, rsOrdLower, rsDigits, diff --git a/camelCase.js b/camelCase.js index 91b40abc9..a4f08f7ae 100644 --- a/camelCase.js +++ b/camelCase.js @@ -21,7 +21,7 @@ import words from './words.js' * // => 'fooBar' */ const camelCase = (string) => ( - words(`${ string }`.replace(/['\u2019]/g, '')).reduce((result, word, index) => { + words(`${string}`.replace(/['\u2019]/g, '')).reduce((result, word, index) => { word = word.toLowerCase() return result + (index ? capitalize(word) : word) }, '') diff --git a/deburr.js b/deburr.js index 0a6a4bcce..f58e8fb61 100644 --- a/deburr.js +++ b/deburr.js @@ -10,7 +10,7 @@ const rsComboSymbolsRange = '\\u20d0-\\u20ff' const rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange /** Used to compose unicode capture groups. */ -const rsCombo = `[${ rsComboRange }]` +const rsCombo = `[${rsComboRange}]` /** * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and diff --git a/invertBy.js b/invertBy.js index e7bd56149..f4995acba 100644 --- a/invertBy.js +++ b/invertBy.js @@ -17,7 +17,7 @@ const hasOwnProperty = Object.prototype.hasOwnProperty * * const object = { 'a': 1, 'b': 2, 'c': 1 } * - * invertBy(object, value => `group${ value }`) + * invertBy(object, value => `group${value}`) * // => { 'group1': ['a', 'c'], 'group2': ['b'] } */ function invertBy(object, iteratee) { diff --git a/kebabCase.js b/kebabCase.js index 4f942cbc4..61b6898ca 100644 --- a/kebabCase.js +++ b/kebabCase.js @@ -21,7 +21,7 @@ import words from './words.js' * // => 'foo-bar' */ const kebabCase = (string) => ( - words(`${ string }`.replace(/['\u2019]/g, '')).reduce((result, word, index) => ( + words(`${string}`.replace(/['\u2019]/g, '')).reduce((result, word, index) => ( result + (index ? '-' : '') + word.toLowerCase() ), '') ) diff --git a/lowerCase.js b/lowerCase.js index 616557b93..66d1b6a1b 100644 --- a/lowerCase.js +++ b/lowerCase.js @@ -20,7 +20,7 @@ import words from './words.js' * // => 'foo bar' */ const lowerCase = (string) => ( - words(`${ string }`.replace(/['\u2019]/g, '')).reduce((result, word, index) => ( + words(`${string}`.replace(/['\u2019]/g, '')).reduce((result, word, index) => ( result + (index ? ' ' : '') + word.toLowerCase() ), '') ) diff --git a/parseInt.js b/parseInt.js index b496ef4c3..3c9d82e93 100644 --- a/parseInt.js +++ b/parseInt.js @@ -33,7 +33,7 @@ function parseInt(string, radix) { } else if (radix) { radix = +radix } - return nativeParseInt(`${ string }`.replace(reTrimStart, ''), radix || 0) + return nativeParseInt(`${string}`.replace(reTrimStart, ''), radix || 0) } export default parseInt diff --git a/random.js b/random.js index c297285e3..c906109da 100644 --- a/random.js +++ b/random.js @@ -64,8 +64,8 @@ function random(lower, upper, floating) { } if (floating || lower % 1 || upper % 1) { const rand = Math.random() - const randLength = `${ rand }`.length - 1 - return Math.min(lower + (rand * (upper - lower + freeParseFloat(`1e-${ randLength }`)), upper)) + const randLength = `${rand}`.length - 1 + return Math.min(lower + (rand * (upper - lower + freeParseFloat(`1e-${randLength}`)), upper)) } return lower + Math.floor(Math.random() * (upper - lower + 1)) } diff --git a/replace.js b/replace.js index 165acfbd3..d53d0fdb6 100644 --- a/replace.js +++ b/replace.js @@ -17,7 +17,7 @@ * // => 'Hi Barney' */ function replace(...args) { - const string = `${ args[0] }` + const string = `${args[0]}` return args.length < 3 ? string : string.replace(args[1], args[2]) } diff --git a/snakeCase.js b/snakeCase.js index fa3e61ed5..794a0e1ff 100644 --- a/snakeCase.js +++ b/snakeCase.js @@ -21,7 +21,7 @@ import words from './words.js' * // => 'foo_bar' */ const snakeCase = (string) => ( - words(`${ string }`.replace(/['\u2019]/g, '')).reduce((result, word, index) => ( + words(`${string}`.replace(/['\u2019]/g, '')).reduce((result, word, index) => ( result + (index ? '_' : '') + word.toLowerCase() ), '') ) diff --git a/startCase.js b/startCase.js index 32bf70557..77190ff94 100644 --- a/startCase.js +++ b/startCase.js @@ -22,7 +22,7 @@ import words from './words.js' * // => 'FOO BAR' */ const startCase = (string) => ( - words(`${ string }`.replace(/['\u2019]/g, '')).reduce((result, word, index) => ( + words(`${string}`.replace(/['\u2019]/g, '')).reduce((result, word, index) => ( result + (index ? ' ' : '') + upperFirst(word) ), '') ) diff --git a/startsWith.js b/startsWith.js index 4764e9ccf..dfdbf551c 100644 --- a/startsWith.js +++ b/startsWith.js @@ -29,7 +29,7 @@ function startsWith(string, target, position) { else if (position > length) { position = length } - target = `${ target }` + target = `${target}` return string.slice(position, position + target.length) == target } diff --git a/template.js b/template.js index a4715fb72..a7e0335b9 100644 --- a/template.js +++ b/template.js @@ -155,16 +155,16 @@ function template(string, options) { let source = "__p += '" // Compile the regexp to match each delimiter. - const reDelimiters = RegExp(`${ [ + const reDelimiters = RegExp(`${[ (options.escape || reNoMatch).source, interpolate.source, (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source, (options.evaluate || reNoMatch).source - ].join('|') }|$`, 'g') + ].join('|')}|$`, 'g') // Use a sourceURL for easier debugging. const sourceURL = 'sourceURL' in options - ? `//# sourceURL=${ options.sourceURL }\n` + ? `//# sourceURL=${options.sourceURL}\n` : '' string.replace(reDelimiters, ( @@ -180,19 +180,19 @@ function template(string, options) { // Escape characters that can't be included in string literals. source += string .slice(index, offset) - .replace(reUnescapedString, (chr) => `\\${ stringEscapes[chr] }`) + .replace(reUnescapedString, (chr) => `\\${stringEscapes[chr]}`) // Replace delimiters with snippets. if (escapeValue) { isEscaping = true - source += `' +\n__e(${ escapeValue }) +\n'` + source += `' +\n__e(${escapeValue}) +\n'` } if (evaluateValue) { isEvaluating = true - source += `';\n${ evaluateValue };\n__p += '` + source += `';\n${evaluateValue};\n__p += '` } if (interpolateValue) { - source += `' +\n((__t = (${ interpolateValue })) == null ? '' : __t) +\n'` + source += `' +\n((__t = (${interpolateValue})) == null ? '' : __t) +\n'` } index = offset + match.length @@ -207,7 +207,7 @@ function template(string, options) { // code to add the data object to the top of the scope chain. const variable = options.variable if (!variable) { - source = `with (obj) {\n${ source }\n}\n` + source = `with (obj) {\n${source}\n}\n` } // Cleanup code by stripping empty strings. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) @@ -215,15 +215,15 @@ function template(string, options) { .replace(reEmptyStringTrailing, '$1;') // Frame code as the function body. - source = `function(${ variable || 'obj' }) {\n` + - `${ variable ? '' : 'obj || (obj = {});\n' }` + + source = `function(${variable || 'obj'}) {\n` + + `${variable ? '' : 'obj || (obj = {});\n'}` + `var __t, __p = ''` + - `${ isEscaping ? ', __e = _.escape' : '' }` + - `${ isEvaluating ? ', __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, \'\') }\n' : ';\n' }` + - `${ source } return __p;\n}` + `${isEscaping ? ', __e = _.escape' : ''}` + + `${isEvaluating ? ', __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, \'\') }\n' : ';\n'}` + + `${source} return __p;\n}` const result = attempt(() => ( - Function(importsKeys, `${ sourceURL }return ${ source }`))(...importsValues) + Function(importsKeys, `${sourceURL}return ${source}`))(...importsValues) ) // Provide the compiled function's source by its `toString` method or diff --git a/toNumber.js b/toNumber.js index ffd8ccbc7..f909a9f00 100644 --- a/toNumber.js +++ b/toNumber.js @@ -50,7 +50,7 @@ function toNumber(value) { } if (isObject(value)) { const other = typeof value.valueOf == 'function' ? value.valueOf() : value - value = isObject(other) ? `${ other }` : other + value = isObject(other) ? `${other}` : other } if (typeof value != 'string') { return value === 0 ? value : +value diff --git a/toString.js b/toString.js index 307e8da48..57f9fff94 100644 --- a/toString.js +++ b/toString.js @@ -37,12 +37,12 @@ function toString(value) { } if (Array.isArray(value)) { // Recursively convert values (susceptible to call stack limits). - return `${ arrayMap(value, (other) => other == null ? other : toString(other)) }` + return `${arrayMap(value, (other) => other == null ? other : toString(other))}` } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : '' } - const result = `${ value }` + const result = `${value}` return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result } diff --git a/truncate.js b/truncate.js index febac16d1..de0eef11f 100644 --- a/truncate.js +++ b/truncate.js @@ -89,7 +89,7 @@ function truncate(string, options) { const substring = result if (!separator.global) { - separator = RegExp(separator.source, `${ reFlags.exec(separator) || '' }g`) + separator = RegExp(separator.source, `${reFlags.exec(separator) || ''}g`) } separator.lastIndex = 0 while ((match = separator.exec(substring))) { diff --git a/uniqueId.js b/uniqueId.js index c785f8b39..19a7eb1e6 100644 --- a/uniqueId.js +++ b/uniqueId.js @@ -19,7 +19,7 @@ let idCounter = 0 */ function uniqueId(prefix) { const id = ++idCounter - return `${ prefix + id }` + return `${prefix + id}` } export default uniqueId diff --git a/upperCase.js b/upperCase.js index c75f22232..68839526e 100644 --- a/upperCase.js +++ b/upperCase.js @@ -20,7 +20,7 @@ import words from './words.js' * // => 'FOO BAR' */ const upperCase = (string) => ( - words(`${ string }`.replace(/['\u2019]/g, '')).reduce((result, word, index) => ( + words(`${string}`.replace(/['\u2019]/g, '')).reduce((result, word, index) => ( result + (index ? ' ' : '') + word.toUpperCase() ), '') )