X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Funcss%2Fnode_modules%2Flodash%2Finternal%2FcreateCaseFirst.js;fp=node_modules%2Funcss%2Fnode_modules%2Flodash%2Finternal%2FcreateCaseFirst.js;h=2c29e0137c951b6513ea2cb515fcbc9c29d0029e;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/uncss/node_modules/lodash/internal/createCaseFirst.js b/node_modules/uncss/node_modules/lodash/internal/createCaseFirst.js new file mode 100644 index 000000000..2c29e0137 --- /dev/null +++ b/node_modules/uncss/node_modules/lodash/internal/createCaseFirst.js @@ -0,0 +1,35 @@ +var stringToArray = require('./stringToArray'), + toString = require('../toString'); + +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', + rsComboSymbolsRange = '\\u20d0-\\u20f0', + rsVarRange = '\\ufe0e\\ufe0f'; + +/** Used to compose unicode capture groups. */ +var 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/). */ +var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); + +/** + * Creates a function like `_.lowerFirst`. + * + * @private + * @param {string} methodName The name of the `String` case method to use. + * @returns {Function} Returns the new function. + */ +function createCaseFirst(methodName) { + return function(string) { + string = toString(string); + + var strSymbols = reHasComplexSymbol.test(string) ? stringToArray(string) : undefined, + chr = strSymbols ? strSymbols[0] : string.charAt(0), + trailing = strSymbols ? strSymbols.slice(1).join('') : string.slice(1); + + return chr[methodName]() + trailing; + }; +} + +module.exports = createCaseFirst;