source: node_modules/ramda-adjunct/src/trimEnd.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: 840 bytes
Line 
1import { invoker } from 'ramda';
2
3import ponyfill from './internal/ponyfills/String.trimEnd';
4import isFunction from './isFunction';
5
6export const trimEndPonyfill = ponyfill;
7
8export const trimEndInvoker = invoker(0, 'trimEnd');
9
10/**
11 * Removes whitespace from the end of a string.
12 *
13 * @func trimEnd
14 * @memberOf RA
15 * @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
16 * @category String
17 * @sig String -> String
18 * @param {string} value String value to have the whitespace removed from the end
19 * @return {string} A new string representing the calling string stripped of whitespace from its end (right end).
20 * @see {@link RA.trimEnd|trimEnd}
21 * @example
22 *
23 * RA.trimEnd('abc '); //=> 'abc'
24 */
25
26const trimEnd = isFunction(String.prototype.trimEnd)
27 ? trimEndInvoker
28 : trimEndPonyfill;
29
30export default trimEnd;
Note: See TracBrowser for help on using the repository browser.