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:
906 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | var _curry2 =
|
---|
| 2 | /*#__PURE__*/
|
---|
| 3 | require("./internal/_curry2.js");
|
---|
| 4 |
|
---|
| 5 | var equals =
|
---|
| 6 | /*#__PURE__*/
|
---|
| 7 | require("./equals.js");
|
---|
| 8 |
|
---|
| 9 | var take =
|
---|
| 10 | /*#__PURE__*/
|
---|
| 11 | require("./take.js");
|
---|
| 12 | /**
|
---|
| 13 | * Checks if a list starts with the provided sublist.
|
---|
| 14 | *
|
---|
| 15 | * Similarly, checks if a string starts 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 {*} prefix
|
---|
| 24 | * @param {*} list
|
---|
| 25 | * @return {Boolean}
|
---|
| 26 | * @see R.endsWith
|
---|
| 27 | * @example
|
---|
| 28 | *
|
---|
| 29 | * R.startsWith('a', 'abc') //=> true
|
---|
| 30 | * R.startsWith('b', 'abc') //=> false
|
---|
| 31 | * R.startsWith(['a'], ['a', 'b', 'c']) //=> true
|
---|
| 32 | * R.startsWith(['b'], ['a', 'b', 'c']) //=> false
|
---|
| 33 | */
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | var startsWith =
|
---|
| 37 | /*#__PURE__*/
|
---|
| 38 | _curry2(function (prefix, list) {
|
---|
| 39 | return equals(take(prefix.length, list), prefix);
|
---|
| 40 | });
|
---|
| 41 |
|
---|
| 42 | module.exports = startsWith; |
---|
Note:
See
TracBrowser
for help on using the repository browser.