source: node_modules/ramda-adjunct/src/trimCharsEnd.js@ d24f17c

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: 680 bytes
Line 
1import { curry, dropLastWhile, join, pipe, split } from 'ramda';
2
3import included from './included';
4
5/**
6 * Removes specified characters from the end of a string.
7 *
8 * @func trimCharsEnd
9 * @memberOf RA
10 * @since {@link https://char0n.github.io/ramda-adjunct/2.25.0|v2.25.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.trimCharsEnd('_-', '-_-abc-_-'); //=> '-_-abc'
19 */
20
21const trimCharsEnd = curry((chars, value) =>
22 pipe(split(''), dropLastWhile(included(chars)), join(''))(value)
23);
24
25export default trimCharsEnd;
Note: See TracBrowser for help on using the repository browser.