source: node_modules/ramda-adjunct/src/trimCharsStart.js

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: 686 bytes
Line 
1import { curry, dropWhile, join, pipe, split } from 'ramda';
2
3import 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
21const trimCharsStart = curry((chars, value) =>
22 pipe(split(''), dropWhile(included(chars)), join(''))(value)
23);
24
25export default trimCharsStart;
Note: See TracBrowser for help on using the repository browser.