source: node_modules/ramda-adjunct/es/trimCharsEnd.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: 692 bytes
Line 
1import { curry, dropLastWhile, join, pipe, split } from 'ramda';
2import included from './included';
3
4/**
5 * Removes specified characters from the end of a string.
6 *
7 * @func trimCharsEnd
8 * @memberOf RA
9 * @since {@link https://char0n.github.io/ramda-adjunct/2.25.0|v2.25.0}
10 * @category String
11 * @sig String -> String
12 * @param {string} chars The characters to trim
13 * @param {string} value The string to trim
14 * @return {string} Returns the trimmed string.
15 * @example
16 *
17 * RA.trimCharsEnd('_-', '-_-abc-_-'); //=> '-_-abc'
18 */
19
20var trimCharsEnd = curry(function (chars, value) {
21 return pipe(split(''), dropLastWhile(included(chars)), join(''))(value);
22});
23export default trimCharsEnd;
Note: See TracBrowser for help on using the repository browser.