swc/crates/swc_bundler/tests/.cache/deno/f5148cb5ed654f7a17e5486c6eb668bef01a6f61.ts
2021-11-09 20:42:49 +09:00

34 lines
891 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Loaded from https://deno.land/x/ramda@v0.27.2/source/test.js
import _cloneRegExp from './internal/_cloneRegExp.js';
import _curry2 from './internal/_curry2.js';
import _isRegExp from './internal/_isRegExp.js';
import toString from './toString.js';
/**
* Determines whether a given string matches a given regular expression.
*
* @func
* @memberOf R
* @since v0.12.0
* @category String
* @sig RegExp -> String -> Boolean
* @param {RegExp} pattern
* @param {String} str
* @return {Boolean}
* @see R.match
* @example
*
* R.test(/^x/, 'xyz'); //=> true
* R.test(/^y/, 'xyz'); //=> false
*/
var test = _curry2(function test(pattern, str) {
if (!_isRegExp(pattern)) {
throw new TypeError('test requires a value of type RegExp as its first argument; received ' + toString(pattern));
}
return _cloneRegExp(pattern).test(str);
});
export default test;