UNPKG

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