UNPKG

900 BJavaScriptView Raw
1import { CC_TO_LO, CC_TO_UP } from './camelCase.js';
2/** @internal */
3function converter(map) {
4 return (value) => value
5 ? map[value.charCodeAt(0)] + value.slice(1)
6 : '';
7}
8/**
9 * @name stringLowerFirst
10 * @summary Lowercase the first letter of a string
11 * @description
12 * Lowercase the first letter of a string
13 * @example
14 * <BR>
15 *
16 * ```javascript
17 * import { stringLowerFirst } from '@polkadot/util';
18 *
19 * stringLowerFirst('ABC'); // => 'aBC'
20 * ```
21 */
22export const stringLowerFirst = /*#__PURE__*/ converter(CC_TO_LO);
23/**
24 * @name stringUpperFirst
25 * @summary Uppercase the first letter of a string
26 * @description
27 * Lowercase the first letter of a string
28 * @example
29 * <BR>
30 *
31 * ```javascript
32 * import { stringUpperFirst } from '@polkadot/util';
33 *
34 * stringUpperFirst('abc'); // => 'Abc'
35 * ```
36 */
37export const stringUpperFirst = /*#__PURE__*/ converter(CC_TO_UP);