source: imaps-frontend/node_modules/safe-regex-test/index.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 405 bytes
RevLine 
[d565449]1'use strict';
2
[79a0317]3var callBound = require('call-bound');
[d565449]4var isRegex = require('is-regex');
5
6var $exec = callBound('RegExp.prototype.exec');
7var $TypeError = require('es-errors/type');
8
[79a0317]9/** @type {import('.')} */
[d565449]10module.exports = function regexTester(regex) {
11 if (!isRegex(regex)) {
12 throw new $TypeError('`regex` must be a RegExp');
13 }
14 return function test(s) {
15 return $exec(regex, s) !== null;
16 };
17};
Note: See TracBrowser for help on using the repository browser.