ramda-adjunct
Version:
Ramda Adjunct is the most popular and most comprehensive set of utilities for use with Ramda, providing a variety of useful, well tested functions with excellent documentation.
23 lines (21 loc) • 701 B
JavaScript
import { curry, dropWhile, join, pipe, split } from 'ramda';
import included from './included.js';
/**
* Removes specified characters from the beginning of a string.
*
* @func trimCharsStart
* @memberOf RA
* @since {@link https://char0n.github.io/ramda-adjunct/2.24.0|v2.24.0}
* @category String
* @sig String -> String
* @param {string} chars The characters to trim
* @param {string} value The string to trim
* @return {string} Returns the trimmed string.
* @example
*
* RA.trimCharsStart('_-', '-_-abc-_-'); //=> 'abc-_-'
*/
var trimCharsStart = curry(function (chars, value) {
return pipe(split(''), dropWhile(included(chars)), join(''))(value);
});
export default trimCharsStart;