UNPKG

1.11 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.stringUpperFirst = exports.stringLowerFirst = void 0;
7
8// Copyright 2017-2022 @polkadot/util authors & contributors
9// SPDX-License-Identifier: Apache-2.0
10function 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
29const 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
45exports.stringLowerFirst = stringLowerFirst;
46const stringUpperFirst = converter(s => s.toUpperCase());
47exports.stringUpperFirst = stringUpperFirst;
\No newline at end of file