main
Last change
on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
840 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { invoker } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | import ponyfill from './internal/ponyfills/String.trimEnd';
|
---|
| 4 | import isFunction from './isFunction';
|
---|
| 5 |
|
---|
| 6 | export const trimEndPonyfill = ponyfill;
|
---|
| 7 |
|
---|
| 8 | export 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 |
|
---|
| 26 | const trimEnd = isFunction(String.prototype.trimEnd)
|
---|
| 27 | ? trimEndInvoker
|
---|
| 28 | : trimEndPonyfill;
|
---|
| 29 |
|
---|
| 30 | export default trimEnd;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.