1 | import _curry2 from "./internal/_curry2.js";
|
2 | import equals from "./equals.js";
|
3 | import takeLast from "./takeLast.js";
|
4 | /**
|
5 | * Checks if a list ends with the provided sublist.
|
6 | *
|
7 | * Similarly, checks if a string ends with the provided substring.
|
8 | *
|
9 | * @func
|
10 | * @memberOf R
|
11 | * @since v0.24.0
|
12 | * @category List
|
13 | * @sig [a] -> [a] -> Boolean
|
14 | * @sig String -> String -> Boolean
|
15 | * @param {*} suffix
|
16 | * @param {*} list
|
17 | * @return {Boolean}
|
18 | * @see R.startsWith
|
19 | * @example
|
20 | *
|
21 | * R.endsWith('c', 'abc') //=> true
|
22 | * R.endsWith('b', 'abc') //=> false
|
23 | * R.endsWith(['c'], ['a', 'b', 'c']) //=> true
|
24 | * R.endsWith(['b'], ['a', 'b', 'c']) //=> false
|
25 | */
|
26 |
|
27 | var endsWith =
|
28 | /*#__PURE__*/
|
29 | _curry2(function (suffix, list) {
|
30 | return equals(takeLast(suffix.length, list), suffix);
|
31 | });
|
32 |
|
33 | export default endsWith; |
\ | No newline at end of file |