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:
904 bytes
|
Line | |
---|
1 | var _curry2 =
|
---|
2 | /*#__PURE__*/
|
---|
3 | require("./internal/_curry2.js");
|
---|
4 |
|
---|
5 | var equals =
|
---|
6 | /*#__PURE__*/
|
---|
7 | require("./equals.js");
|
---|
8 |
|
---|
9 | var takeLast =
|
---|
10 | /*#__PURE__*/
|
---|
11 | require("./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 |
|
---|
36 | var endsWith =
|
---|
37 | /*#__PURE__*/
|
---|
38 | _curry2(function (suffix, list) {
|
---|
39 | return equals(takeLast(suffix.length, list), suffix);
|
---|
40 | });
|
---|
41 |
|
---|
42 | module.exports = endsWith; |
---|
Note:
See
TracBrowser
for help on using the repository browser.