Add stringLowerFirst, stringUpperFirst, stringCamelCase (#219)

* Add stringLowerFirst

* Add stringUpperFirst

* Change test description

* Add camelcase

* Add header
This commit is contained in:
Amaury Martiny
2018-09-28 13:38:36 +02:00
committed by Jaco Greeff
parent a634fe380c
commit 9a6a02ce46
8 changed files with 220 additions and 10 deletions
+25
View File
@@ -0,0 +1,25 @@
// Copyright 2017-2018 @polkadot/util authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import isNull from '../is/null';
import isUndefined from '../is/undefined';
/**
* @name stringLowerFirst
* @signature stringLowerFirst (_value: string): string
* @summary Lowercase the first letter of a string
* @description
* Lowercase the first letter of a string
* @example
* import { stringLowerFirst } from '@polkadot/util';
*
* stringLowerFirst('ABC'); // => 'aBC'
*/
export default function stringLowerFirst (_value: string): string {
if (isNull(_value) || isUndefined(_value)) {
return _value;
}
return _value.charAt(0).toLowerCase() + _value.slice(1);
}