source: node_modules/ramda/src/startsWith.js

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