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:
992 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | var _curry2 =
|
---|
| 2 | /*#__PURE__*/
|
---|
| 3 | require("./internal/_curry2.js");
|
---|
| 4 | /**
|
---|
| 5 | * Tests a regular expression against a String. Note that this function will
|
---|
| 6 | * return an empty array when there are no matches. This differs from
|
---|
| 7 | * [`String.prototype.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match)
|
---|
| 8 | * which returns `null` when there are no matches.
|
---|
| 9 | *
|
---|
| 10 | * @func
|
---|
| 11 | * @memberOf R
|
---|
| 12 | * @since v0.1.0
|
---|
| 13 | * @category String
|
---|
| 14 | * @sig RegExp -> String -> [String | Undefined]
|
---|
| 15 | * @param {RegExp} rx A regular expression.
|
---|
| 16 | * @param {String} str The string to match against
|
---|
| 17 | * @return {Array} The list of matches or empty array.
|
---|
| 18 | * @see R.test
|
---|
| 19 | * @example
|
---|
| 20 | *
|
---|
| 21 | * R.match(/([a-z]a)/g, 'bananas'); //=> ['ba', 'na', 'na']
|
---|
| 22 | * R.match(/a/, 'b'); //=> []
|
---|
| 23 | * R.match(/a/, null); //=> TypeError: null does not have a method named "match"
|
---|
| 24 | */
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | var match =
|
---|
| 28 | /*#__PURE__*/
|
---|
| 29 | _curry2(function match(rx, str) {
|
---|
| 30 | return str.match(rx) || [];
|
---|
| 31 | });
|
---|
| 32 |
|
---|
| 33 | module.exports = match; |
---|
Note:
See
TracBrowser
for help on using the repository browser.