Sha256: c7e18c887a1871cd4fbc21cc79ce0976e180cd2c3b96dd8832aff658c07bb210

Contents?: true

Size: 811 Bytes

Versions: 265

Compression:

Stored size: 811 Bytes

Contents

var castSlice = require('./_castSlice'),
    hasUnicode = require('./_hasUnicode'),
    stringToArray = require('./_stringToArray'),
    toString = require('./toString');

/**
 * Creates a function like `_.lowerFirst`.
 *
 * @private
 * @param {string} methodName The name of the `String` case method to use.
 * @returns {Function} Returns the new case function.
 */
function createCaseFirst(methodName) {
  return function(string) {
    string = toString(string);

    var strSymbols = hasUnicode(string)
      ? stringToArray(string)
      : undefined;

    var chr = strSymbols
      ? strSymbols[0]
      : string.charAt(0);

    var trailing = strSymbols
      ? castSlice(strSymbols, 1).join('')
      : string.slice(1);

    return chr[methodName]() + trailing;
  };
}

module.exports = createCaseFirst;

Version data entries

265 entries across 263 versions & 30 rubygems

Version Path
trusty-cms-6.3.1 node_modules/lodash/_createCaseFirst.js
immosquare-cleaner-0.1.51 node_modules/lodash/_createCaseFirst.js
boring_generators-0.15.0 tmp/templates/app_template/node_modules/lodash/_createCaseFirst.js
clapton-0.0.26 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js
immosquare-cleaner-0.1.50 node_modules/lodash/_createCaseFirst.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js
clapton-0.0.19 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js
clapton-0.0.18 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js
clapton-0.0.17 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js
clapton-0.0.16 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js
clapton-0.0.15 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js
immosquare-cleaner-0.1.49 node_modules/lodash/_createCaseFirst.js
clapton-0.0.14 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js
immosquare-cleaner-0.1.48 node_modules/lodash/_createCaseFirst.js
clapton-0.0.13 lib/clapton/javascripts/node_modules/lodash/_createCaseFirst.js