1-liners
Version:
Useful oneliners and shorthand functions
25 lines (22 loc) • 544 B
JavaScript
/**
* @module 1-liners/test
*
* @description
*
* Same as [`regexObj.test(str)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test).
*
* @example
*
* const test = require('1-liners/test');
* const haystack = 'hAyHAYhayneEdLEHayHAy';
*
* test(haystack, /needle/); // => false
* test(haystack, /needle/i); // => true
*
*/
;
exports.__esModule = true;
exports["default"] = function (str, regexObj) {
return regexObj.test(str);
};
module.exports = exports["default"];