is-regex
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -8,2 +8,18 @@ # Changelog | ||
## [v1.1.2](https://github.com/inspect-js/is-regex/compare/v1.1.1...v1.1.2) - 2021-02-01 | ||
### Commits | ||
- [Tests] migrate tests to Github Actions [`cc1686e`](https://github.com/inspect-js/is-regex/commit/cc1686e25f446ca6948f43b3f180d6e55e31fb4e) | ||
- [readme] fix repo URLs; remove travis badge [`d1d1da6`](https://github.com/inspect-js/is-regex/commit/d1d1da647bb4e91589606f12470cd27a47b3bb81) | ||
- [meta] do not publish github action workflow files [`9f84b99`](https://github.com/inspect-js/is-regex/commit/9f84b993a995f057b4d2d097ef47b1ff9c84115d) | ||
- [Tests] run `nyc` on all tests [`c37aab9`](https://github.com/inspect-js/is-regex/commit/c37aab9d332c4834b08ada94736c45ab1d39cd2f) | ||
- [Robustness] use `call-bind` [`fbb61bf`](https://github.com/inspect-js/is-regex/commit/fbb61bf3e19ccc178e6ed1e0d7ab9cc7c7167393) | ||
- [actions] add "Allow Edits" workflow [`9022b53`](https://github.com/inspect-js/is-regex/commit/9022b53cb05b0f105cd179800cf96e055b249f08) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog` [`d60f28f`](https://github.com/inspect-js/is-regex/commit/d60f28f7f2fb21dade7bce302b3e0246206423d3) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`2c35c43`](https://github.com/inspect-js/is-regex/commit/2c35c437edf3eeb37129eea2404d8f465d27620f) | ||
- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`1009e25`](https://github.com/inspect-js/is-regex/commit/1009e259d49a63753dc6e79e2b876a30c00c6de6) | ||
- [meta] gitignore coverage output [`3b5fa9e`](https://github.com/inspect-js/is-regex/commit/3b5fa9ed2882c65ee81dff979f79f1a2751d3772) | ||
- [actions] update workflows [`1843ef6`](https://github.com/inspect-js/is-regex/commit/1843ef65b8b8c24a44e91bc4ed5ee60dffc31c2d) | ||
## [v1.1.1](https://github.com/inspect-js/is-regex/compare/v1.1.0...v1.1.1) - 2020-08-03 | ||
@@ -10,0 +26,0 @@ |
17
index.js
'use strict'; | ||
var callBound = require('call-bind/callBound'); | ||
var hasSymbols = require('has-symbols')(); | ||
var hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol'; | ||
var hasOwnProperty; | ||
var regexExec; | ||
var has; | ||
var $exec; | ||
var isRegexMarker; | ||
@@ -11,4 +12,4 @@ var badStringifier; | ||
if (hasToStringTag) { | ||
hasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty); | ||
regexExec = Function.call.bind(RegExp.prototype.exec); | ||
has = callBound('Object.prototype.hasOwnProperty'); | ||
$exec = callBound('RegExp.prototype.exec'); | ||
isRegexMarker = {}; | ||
@@ -29,3 +30,3 @@ | ||
var toStr = Object.prototype.toString; | ||
var $toString = callBound('Object.prototype.toString'); | ||
var gOPD = Object.getOwnPropertyDescriptor; | ||
@@ -42,3 +43,3 @@ var regexClass = '[object RegExp]'; | ||
var descriptor = gOPD(value, 'lastIndex'); | ||
var hasLastIndexDataProperty = descriptor && hasOwnProperty(descriptor, 'value'); | ||
var hasLastIndexDataProperty = descriptor && has(descriptor, 'value'); | ||
if (!hasLastIndexDataProperty) { | ||
@@ -49,3 +50,3 @@ return false; | ||
try { | ||
regexExec(value, badStringifier); | ||
$exec(value, badStringifier); | ||
} catch (e) { | ||
@@ -61,3 +62,3 @@ return e === isRegexMarker; | ||
return toStr.call(value) === regexClass; | ||
return $toString(value) === regexClass; | ||
}; |
{ | ||
"name": "is-regex", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag", | ||
@@ -14,6 +14,6 @@ "author": "Jordan Harband <ljharb@gmail.com>", | ||
"pretest": "npm run lint", | ||
"test": "npm run tests-only", | ||
"tests-only": "node --harmony --es-staging test", | ||
"test": "npm run tests-only && npm run test:harmony", | ||
"tests-only": "nyc node test", | ||
"test:harmony": "nyc node --harmony --es-staging test", | ||
"posttest": "npx aud --production", | ||
"coverage": "covert test/index.js", | ||
"lint": "eslint .", | ||
@@ -26,8 +26,8 @@ "eccheck": "eclint check *.js **/*.js > /dev/null", | ||
"type": "git", | ||
"url": "git://github.com/ljharb/is-regex.git" | ||
"url": "git://github.com/inspect-js/is-regex.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ljharb/is-regex/issues" | ||
"url": "https://github.com/inspect-js/is-regex/issues" | ||
}, | ||
"homepage": "https://github.com/ljharb/is-regex", | ||
"homepage": "https://github.com/inspect-js/is-regex", | ||
"keywords": [ | ||
@@ -42,14 +42,15 @@ "regex", | ||
"dependencies": { | ||
"call-bind": "^1.0.2", | ||
"has-symbols": "^1.0.1" | ||
}, | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^17.1.0", | ||
"aud": "^1.1.2", | ||
"auto-changelog": "^2.2.0", | ||
"covert": "^1.1.1", | ||
"@ljharb/eslint-config": "^17.5.0", | ||
"aud": "^1.1.3", | ||
"auto-changelog": "^2.2.1", | ||
"eclint": "^2.8.1", | ||
"eslint": "^7.6.0", | ||
"eslint": "^7.19.0", | ||
"foreach": "^2.0.5", | ||
"nyc": "^10.3.2", | ||
"safe-publish-latest": "^1.1.4", | ||
"tape": "^5.0.1" | ||
"tape": "^5.1.1" | ||
}, | ||
@@ -56,0 +57,0 @@ "testling": { |
@@ -1,4 +0,3 @@ | ||
#is-regex <sup>[![Version Badge][2]][1]</sup> | ||
# is-regex <sup>[![Version Badge][2]][1]</sup> | ||
[![Build Status][3]][4] | ||
[![dependency status][5]][6] | ||
@@ -11,4 +10,2 @@ [![dev dependency status][7]][8] | ||
[![browser support][9]][10] | ||
Is this value a JS regex? | ||
@@ -41,16 +38,12 @@ This module works cross-realm/iframe, and despite ES6 @@toStringTag. | ||
[1]: https://npmjs.org/package/is-regex | ||
[2]: http://versionbadg.es/ljharb/is-regex.svg | ||
[3]: https://travis-ci.org/ljharb/is-regex.svg | ||
[4]: https://travis-ci.org/ljharb/is-regex | ||
[5]: https://david-dm.org/ljharb/is-regex.svg | ||
[6]: https://david-dm.org/ljharb/is-regex | ||
[7]: https://david-dm.org/ljharb/is-regex/dev-status.svg | ||
[8]: https://david-dm.org/ljharb/is-regex#info=devDependencies | ||
[9]: https://ci.testling.com/ljharb/is-regex.png | ||
[10]: https://ci.testling.com/ljharb/is-regex | ||
[2]: https://versionbadg.es/inspect-js/is-regex.svg | ||
[5]: https://david-dm.org/inspect-js/is-regex.svg | ||
[6]: https://david-dm.org/inspect-js/is-regex | ||
[7]: https://david-dm.org/inspect-js/is-regex/dev-status.svg | ||
[8]: https://david-dm.org/inspect-js/is-regex#info=devDependencies | ||
[11]: https://nodei.co/npm/is-regex.png?downloads=true&stars=true | ||
[license-image]: http://img.shields.io/npm/l/is-regex.svg | ||
[license-image]: https://img.shields.io/npm/l/is-regex.svg | ||
[license-url]: LICENSE | ||
[downloads-image]: http://img.shields.io/npm/dm/is-regex.svg | ||
[downloads-url]: http://npm-stat.com/charts.html?package=is-regex | ||
[downloads-image]: https://img.shields.io/npm/dm/is-regex.svg | ||
[downloads-url]: https://npm-stat.com/charts.html?package=is-regex | ||
28249
141
2
48
+ Addedcall-bind@^1.0.2
+ Addedcall-bind@1.0.7(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedset-function-length@1.2.2(transitive)