Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

safe-regex-test

ljharb154.7mMIT1.1.0TypeScript support: included

Give a regex, get a robust predicate function that tests it against a string.

regex, regexp, test, tester, safe, robust, exec

readme

safe-regex-test Version Badge

github actions coverage License Downloads

npm badge

Give a regex, get a robust predicate function that tests it against a string. This will work even if RegExp.prototype is altered later.

Getting started

npm install --save safe-regex-test

Usage/Examples

var regexTester = require('safe-regex-test');
var assert = require('assert');

var tester = regexTester('a');
assert.ok(tester('a'));
assert.notOk(tester('b'));

Tests

Simply clone the repo, npm install, and run npm test

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.1.0 - 2024-12-12

Commits

  • [actions] split out node 10-20, and 20+ b4a46bb
  • [New] add types 5cb24eb
  • [Dev Deps] update @ljharb/eslint-config, auto-changelog, es-value-fixtures, object-inspect, tape e225ca0
  • [Refactor] use call-bound directly 9be3cd2
  • [Deps] update call-bind, is-regex 524b736
  • [Tests] replace aud with npm audit f3cd537
  • [Dev Deps] add missing peer dep 14da559

v1.0.3 - 2024-02-06

Commits

  • [Refactor] use es-errors, so things that only need those do not need get-intrinsic d6ba2f9
  • [Deps] update call-bind, get-intrinsic 5a3b1d7
  • [Dev Deps] update tape 75fb719

v1.0.2 - 2024-01-11

Commits

  • [meta] package.json sideEffects should be boolean 094bb88

v1.0.1 - 2024-01-09

Commits

  • [Tests] add nyc for coverage 7e3f525
  • [Dev Deps] update @ljharb/eslint-config, aud, npmignore, object-inspect, tape e7e0169
  • [actions] update rebase action 2962694
  • [readme] add testing badges; remove david-dm badges e9dfd83
  • [Dev Deps] update @ljharb/eslint-config, aud, object-inspect, tape 496fe99
  • [Deps] update call-bind, get-intrinsic d94c5ba
  • [meta] add missing engines.node f3d4711
  • [Deps] update get-intrinsic 0eeedd7
  • [meta] add sideEffects flag fe1655f

v1.0.0 - 2022-09-22

Commits