main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
686 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { curry, dropWhile, join, pipe, split } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | import included from './included';
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * Removes specified characters from the beginning of a string.
|
---|
| 7 | *
|
---|
| 8 | * @func trimCharsStart
|
---|
| 9 | * @memberOf RA
|
---|
| 10 | * @since {@link https://char0n.github.io/ramda-adjunct/2.24.0|v2.24.0}
|
---|
| 11 | * @category String
|
---|
| 12 | * @sig String -> String
|
---|
| 13 | * @param {string} chars The characters to trim
|
---|
| 14 | * @param {string} value The string to trim
|
---|
| 15 | * @return {string} Returns the trimmed string.
|
---|
| 16 | * @example
|
---|
| 17 | *
|
---|
| 18 | * RA.trimCharsStart('_-', '-_-abc-_-'); //=> 'abc-_-'
|
---|
| 19 | */
|
---|
| 20 |
|
---|
| 21 | const trimCharsStart = curry((chars, value) =>
|
---|
| 22 | pipe(split(''), dropWhile(included(chars)), join(''))(value)
|
---|
| 23 | );
|
---|
| 24 |
|
---|
| 25 | export default trimCharsStart;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.