1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.stringUpperFirst = exports.stringLowerFirst = void 0;
|
7 |
|
8 | // Copyright 2017-2022 @polkadot/util authors & contributors
|
9 | // SPDX-License-Identifier: Apache-2.0
|
10 | function converter(fn) {
|
11 | return value => value ? fn(value[0]) + value.slice(1) : '';
|
12 | }
|
13 | /**
|
14 | * @name stringLowerFirst
|
15 | * @summary Lowercase the first letter of a string
|
16 | * @description
|
17 | * Lowercase the first letter of a string
|
18 | * @example
|
19 | * <BR>
|
20 | *
|
21 | * ```javascript
|
22 | * import { stringLowerFirst } from '@polkadot/util';
|
23 | *
|
24 | * stringLowerFirst('ABC'); // => 'aBC'
|
25 | * ```
|
26 | */
|
27 |
|
28 |
|
29 | const stringLowerFirst = converter(s => s.toLowerCase());
|
30 | /**
|
31 | * @name stringUpperFirst
|
32 | * @summary Uppercase the first letter of a string
|
33 | * @description
|
34 | * Lowercase the first letter of a string
|
35 | * @example
|
36 | * <BR>
|
37 | *
|
38 | * ```javascript
|
39 | * import { stringUpperFirst } from '@polkadot/util';
|
40 | *
|
41 | * stringUpperFirst('abc'); // => 'Abc'
|
42 | * ```
|
43 | */
|
44 |
|
45 | exports.stringLowerFirst = stringLowerFirst;
|
46 | const stringUpperFirst = converter(s => s.toUpperCase());
|
47 | exports.stringUpperFirst = stringUpperFirst; |
\ | No newline at end of file |