Sha256: 81983b9c811def3268db6cbb0e3f92b4c238905d3c4032c4c1e335095ef8901a

Contents?: true

Size: 387 Bytes

Versions: 15

Compression:

Stored size: 387 Bytes

Contents

'use strict';

var callBound = require('call-bind/callBound');
var isRegex = require('is-regex');

var $exec = callBound('RegExp.prototype.exec');
var $TypeError = require('es-errors/type');

module.exports = function regexTester(regex) {
	if (!isRegex(regex)) {
		throw new $TypeError('`regex` must be a RegExp');
	}
	return function test(s) {
		return $exec(regex, s) !== null;
	};
};

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.52 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.51 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.50 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.49 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.48 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.47 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.46 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.45 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.44 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.43 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.42 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.41 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.40 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.39 node_modules/safe-regex-test/index.js
immosquare-cleaner-0.1.38 node_modules/safe-regex-test/index.js