deno.land / x / lodash@4.17.19 / npm-package / _createCaseFirst.js

_createCaseFirst.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;
lodash

Version Info

Tagged at
3 years ago

External Dependencies

No external dependencies 🎉