main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
843 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { invoker } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | import ponyfill from './internal/ponyfills/String.trimStart';
|
---|
| 4 | import isFunction from './isFunction';
|
---|
| 5 |
|
---|
| 6 | export const trimStartPonyfill = ponyfill;
|
---|
| 7 |
|
---|
| 8 | export const trimStartInvoker = invoker(0, 'trimStart');
|
---|
| 9 |
|
---|
| 10 | /**
|
---|
| 11 | * Removes whitespace from the beginning of a string.
|
---|
| 12 | *
|
---|
| 13 | * @func trimStart
|
---|
| 14 | * @memberOf RA
|
---|
| 15 | * @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
---|
| 16 | * @category String
|
---|
| 17 | * @sig String -> String
|
---|
| 18 | * @param {string} value String value to have the whitespace removed from the beginning
|
---|
| 19 | * @return {string} A new string representing the calling string stripped of whitespace from its beginning (left end).
|
---|
| 20 | * @example
|
---|
| 21 | *
|
---|
| 22 | * RA.trimStart(' abc'); //=> 'abc'
|
---|
| 23 | */
|
---|
| 24 |
|
---|
| 25 | const trimStart = isFunction(String.prototype.trimStart)
|
---|
| 26 | ? trimStartInvoker
|
---|
| 27 | : trimStartPonyfill;
|
---|
| 28 |
|
---|
| 29 | export default trimStart;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.