update
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
coverage/
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test",
|
||||
"test-corejs.js"
|
||||
]
|
||||
}
|
||||
+42
-3
@@ -5,9 +5,48 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
## [v1.1.4](https://github.com/inspect-js/is-regex/compare/v1.1.3...v1.1.4) - 2021-08-05
|
||||
|
||||
## [v1.1.0](https://github.com/inspect-js/is-regex/compare/v1.0.5...v1.1.0) - 2020-06-04
|
||||
### Commits
|
||||
|
||||
- [Dev Deps] update `auto-changelog`, `core-js`, `eslint`, `tape` [`4b17cad`](https://github.com/inspect-js/is-regex/commit/4b17cad8496b1ae621b18335fa3afe94d0c65e83)
|
||||
- [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`2dad4af`](https://github.com/inspect-js/is-regex/commit/2dad4afffa15f07cbbf7675b77d1f650c92652c4)
|
||||
|
||||
## [v1.1.3](https://github.com/inspect-js/is-regex/compare/v1.1.2...v1.1.3) - 2021-05-07
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`c681ab9`](https://github.com/inspect-js/is-regex/commit/c681ab99c07f8b3b7ae5f652b3105a30bce94f69)
|
||||
- [Fix] do not use `Object.prototype.toString` when `Symbol.toStringTag` is shammed [`ca019fd`](https://github.com/inspect-js/is-regex/commit/ca019fdb828dc7d32e323213403ac9995d8604e3)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`605a66f`](https://github.com/inspect-js/is-regex/commit/605a66f278900f1c8ae9d1dfcec31e5f61b10ad3)
|
||||
- [readme] add actions and codecov badges [`8d7c6f0`](https://github.com/inspect-js/is-regex/commit/8d7c6f0e007bd982f21b958e0abc98b8a84e2a24)
|
||||
- [meta] use `prepublishOnly` script for npm 7+ [`8e50e91`](https://github.com/inspect-js/is-regex/commit/8e50e91f51aa5038745526710ef2e030527982a7)
|
||||
- [Deps] update `has-symbols` [`4742c81`](https://github.com/inspect-js/is-regex/commit/4742c81260c3db9a8c9ef57110981fb6175f58e0)
|
||||
|
||||
## [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
|
||||
|
||||
### Commits
|
||||
|
||||
- [Performance] Re-add lastIndex check to improve performance [`d8495cd`](https://github.com/inspect-js/is-regex/commit/d8495cd22d475ddca250818921b6088f631c1972)
|
||||
- [Dev Deps] update `auto-changelog`, `eslint` [`778fa6b`](https://github.com/inspect-js/is-regex/commit/778fa6b9d2b182ee6d73993e103532855e956f85)
|
||||
|
||||
## [v1.1.0](https://github.com/inspect-js/is-regex/compare/v1.0.5...v1.1.0) - 2020-06-03
|
||||
|
||||
### Commits
|
||||
|
||||
@@ -93,7 +132,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
- Test on `io.js` `v2.3` [`23170f5`](https://github.com/inspect-js/is-regex/commit/23170f5cae632d0377de73bd2febc53db8aebbc9)
|
||||
- Test on `iojs-v1.6` [`4487ad0`](https://github.com/inspect-js/is-regex/commit/4487ad0194a5684223bfa2690da4e0a441f7132a)
|
||||
|
||||
## [v1.0.3](https://github.com/inspect-js/is-regex/compare/v1.0.2...v1.0.3) - 2015-01-30
|
||||
## [v1.0.3](https://github.com/inspect-js/is-regex/compare/v1.0.2...v1.0.3) - 2015-01-29
|
||||
|
||||
### Commits
|
||||
|
||||
|
||||
+15
-17
@@ -1,6 +1,7 @@
|
||||
#is-regex <sup>[![Version Badge][2]][1]</sup>
|
||||
# is-regex <sup>[![Version Badge][2]][1]</sup>
|
||||
|
||||
[![Build Status][3]][4]
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][5]][6]
|
||||
[![dev dependency status][7]][8]
|
||||
[![License][license-image]][license-url]
|
||||
@@ -8,8 +9,6 @@
|
||||
|
||||
[![npm badge][11]][1]
|
||||
|
||||
[![browser support][9]][10]
|
||||
|
||||
Is this value a JS regex?
|
||||
This module works cross-realm/iframe, and despite ES6 @@toStringTag.
|
||||
|
||||
@@ -37,18 +36,17 @@ assert.ok(isRegex(new RegExp('a', 'g')));
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[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
|
||||
[codecov-image]: https://codecov.io/gh/inspect-js/is-regex/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/inspect-js/is-regex/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-regex
|
||||
[actions-url]: https://github.com/inspect-js/is-regex/actions
|
||||
|
||||
+16
-7
@@ -1,13 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var hasSymbols = require('has-symbols')();
|
||||
var hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol';
|
||||
var regexExec;
|
||||
var callBound = require('call-bind/callBound');
|
||||
var hasToStringTag = require('has-tostringtag/shams')();
|
||||
var has;
|
||||
var $exec;
|
||||
var isRegexMarker;
|
||||
var badStringifier;
|
||||
|
||||
if (hasToStringTag) {
|
||||
regexExec = Function.call.bind(RegExp.prototype.exec);
|
||||
has = callBound('Object.prototype.hasOwnProperty');
|
||||
$exec = callBound('RegExp.prototype.exec');
|
||||
isRegexMarker = {};
|
||||
|
||||
var throwRegexMarker = function () {
|
||||
@@ -23,7 +25,8 @@ if (hasToStringTag) {
|
||||
}
|
||||
}
|
||||
|
||||
var toStr = Object.prototype.toString;
|
||||
var $toString = callBound('Object.prototype.toString');
|
||||
var gOPD = Object.getOwnPropertyDescriptor;
|
||||
var regexClass = '[object RegExp]';
|
||||
|
||||
module.exports = hasToStringTag
|
||||
@@ -33,8 +36,14 @@ module.exports = hasToStringTag
|
||||
return false;
|
||||
}
|
||||
|
||||
var descriptor = gOPD(value, 'lastIndex');
|
||||
var hasLastIndexDataProperty = descriptor && has(descriptor, 'value');
|
||||
if (!hasLastIndexDataProperty) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
regexExec(value, badStringifier);
|
||||
$exec(value, badStringifier);
|
||||
} catch (e) {
|
||||
return e === isRegexMarker;
|
||||
}
|
||||
@@ -45,5 +54,5 @@ module.exports = hasToStringTag
|
||||
return false;
|
||||
}
|
||||
|
||||
return toStr.call(value) === regexClass;
|
||||
return $toString(value) === regexClass;
|
||||
};
|
||||
|
||||
+34
-30
@@ -1,33 +1,33 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"is-regex@1.1.0",
|
||||
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
|
||||
"is-regex@1.1.4",
|
||||
"/home/node/nuxt"
|
||||
]
|
||||
],
|
||||
"_from": "is-regex@1.1.0",
|
||||
"_id": "is-regex@1.1.0",
|
||||
"_from": "is-regex@1.1.4",
|
||||
"_id": "is-regex@1.1.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-iI97M8KTWID2la5uYXlkbSDQIg4F6o1sYboZKKTDpnDQMLtUL86zxhgDet3Q2SriaYsyGqZ6Mn2SjbRKeLHdqw==",
|
||||
"_integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==",
|
||||
"_location": "/is-regex",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "is-regex@1.1.0",
|
||||
"raw": "is-regex@1.1.4",
|
||||
"name": "is-regex",
|
||||
"escapedName": "is-regex",
|
||||
"rawSpec": "1.1.0",
|
||||
"rawSpec": "1.1.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.0"
|
||||
"fetchSpec": "1.1.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/character-parser",
|
||||
"/es-abstract"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.0.tgz",
|
||||
"_spec": "1.1.0",
|
||||
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
|
||||
"_resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",
|
||||
"_spec": "1.1.4",
|
||||
"_where": "/home/node/nuxt",
|
||||
"author": {
|
||||
"name": "Jordan Harband",
|
||||
"email": "ljharb@gmail.com"
|
||||
@@ -37,25 +37,28 @@
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ljharb/is-regex/issues"
|
||||
"url": "https://github.com/inspect-js/is-regex/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"has-symbols": "^1.0.1"
|
||||
"call-bind": "^1.0.2",
|
||||
"has-tostringtag": "^1.0.0"
|
||||
},
|
||||
"description": "Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag",
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^17.1.0",
|
||||
"aud": "^1.1.2",
|
||||
"auto-changelog": "^2.0.0",
|
||||
"covert": "^1.1.1",
|
||||
"@ljharb/eslint-config": "^17.6.0",
|
||||
"aud": "^1.1.5",
|
||||
"auto-changelog": "^2.3.0",
|
||||
"core-js": "^3.16.0",
|
||||
"eclint": "^2.8.1",
|
||||
"eslint": "^7.1.0",
|
||||
"eslint": "^7.32.0",
|
||||
"foreach": "^2.0.5",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^1.1.4",
|
||||
"tape": "^5.0.1"
|
||||
"tape": "^5.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
@@ -63,7 +66,7 @@
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"homepage": "https://github.com/ljharb/is-regex",
|
||||
"homepage": "https://github.com/inspect-js/is-regex",
|
||||
"keywords": [
|
||||
"regex",
|
||||
"regexp",
|
||||
@@ -77,22 +80,24 @@
|
||||
"name": "is-regex",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/ljharb/is-regex.git"
|
||||
"url": "git://github.com/inspect-js/is-regex.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "covert test/index.js",
|
||||
"eccheck": "eclint check *.js **/*.js > /dev/null",
|
||||
"lint": "eslint .",
|
||||
"posttest": "npx aud --production",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"",
|
||||
"prepublish": "safe-publish-latest",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"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",
|
||||
"test:corejs": "nyc tape test-corejs.js",
|
||||
"test:harmony": "nyc node --harmony --es-staging test",
|
||||
"tests-only": "nyc node test",
|
||||
"version": "auto-changelog && git add CHANGELOG.md"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test.js",
|
||||
"files": "test/index.js",
|
||||
"browsers": [
|
||||
"iexplore/6.0..latest",
|
||||
"firefox/3.0..6.0",
|
||||
@@ -101,8 +106,7 @@
|
||||
"chrome/4.0..10.0",
|
||||
"chrome/20.0..latest",
|
||||
"chrome/canary",
|
||||
"opera/10.0..12.0",
|
||||
"opera/15.0..latest",
|
||||
"opera/10.0..latest",
|
||||
"opera/next",
|
||||
"safari/4.0..latest",
|
||||
"ipad/6.0..latest",
|
||||
@@ -110,5 +114,5 @@
|
||||
"android-browser/4.2"
|
||||
]
|
||||
},
|
||||
"version": "1.1.0"
|
||||
"version": "1.1.4"
|
||||
}
|
||||
|
||||
+5
-6
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var hasSymbols = require('has-symbols')();
|
||||
var hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol';
|
||||
var hasToStringTag = require('has-tostringtag/shams')();
|
||||
var forEach = require('foreach');
|
||||
var test = require('tape');
|
||||
var isRegex = require('..');
|
||||
@@ -61,7 +60,7 @@ test('does not mutate regexes', function (t) {
|
||||
|
||||
test('does not perform operations observable to Proxies', { skip: typeof Proxy !== 'function' }, function (t) {
|
||||
var Handler = function () {
|
||||
this.trapCalls = 0;
|
||||
this.trapCalls = [];
|
||||
};
|
||||
|
||||
forEach([
|
||||
@@ -78,7 +77,7 @@ test('does not perform operations observable to Proxies', { skip: typeof Proxy !
|
||||
'setPrototypeOf'
|
||||
], function (trapName) {
|
||||
Handler.prototype[trapName] = function () {
|
||||
this.trapCalls += 1;
|
||||
this.trapCalls.push(trapName);
|
||||
return Reflect[trapName].apply(Reflect, arguments);
|
||||
};
|
||||
});
|
||||
@@ -88,7 +87,7 @@ test('does not perform operations observable to Proxies', { skip: typeof Proxy !
|
||||
var proxy = new Proxy({ lastIndex: 0 }, handler);
|
||||
|
||||
st.equal(isRegex(proxy), false, 'proxy of plain object is not regex');
|
||||
st.equal(handler.trapCalls, 0, 'no proxy traps were triggered');
|
||||
st.deepEqual(handler.trapCalls, ['getOwnPropertyDescriptor'], 'no unexpected proxy traps were triggered');
|
||||
st.end();
|
||||
});
|
||||
|
||||
@@ -97,7 +96,7 @@ test('does not perform operations observable to Proxies', { skip: typeof Proxy !
|
||||
var proxy = new Proxy(/a/, handler);
|
||||
|
||||
st.equal(isRegex(proxy), false, 'proxy of RegExp instance is not regex');
|
||||
st.equal(handler.trapCalls, 0, 'no proxy traps were triggered');
|
||||
st.deepEqual(handler.trapCalls, ['getOwnPropertyDescriptor'], 'no unexpected proxy traps were triggered');
|
||||
st.end();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user