source: node_modules/ramda/src/endsWith.js@ e48199a

main
Last change on this file since e48199a was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 904 bytes
Line 
1var _curry2 =
2/*#__PURE__*/
3require("./internal/_curry2.js");
4
5var equals =
6/*#__PURE__*/
7require("./equals.js");
8
9var takeLast =
10/*#__PURE__*/
11require("./takeLast.js");
12/**
13 * Checks if a list ends with the provided sublist.
14 *
15 * Similarly, checks if a string ends with the provided substring.
16 *
17 * @func
18 * @memberOf R
19 * @since v0.24.0
20 * @category List
21 * @sig [a] -> [a] -> Boolean
22 * @sig String -> String -> Boolean
23 * @param {*} suffix
24 * @param {*} list
25 * @return {Boolean}
26 * @see R.startsWith
27 * @example
28 *
29 * R.endsWith('c', 'abc') //=> true
30 * R.endsWith('b', 'abc') //=> false
31 * R.endsWith(['c'], ['a', 'b', 'c']) //=> true
32 * R.endsWith(['b'], ['a', 'b', 'c']) //=> false
33 */
34
35
36var endsWith =
37/*#__PURE__*/
38_curry2(function (suffix, list) {
39 return equals(takeLast(suffix.length, list), suffix);
40});
41
42module.exports = endsWith;
Note: See TracBrowser for help on using the repository browser.