cdk-lambda-subminute 2.0.576 → 2.0.578

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/.jsii +2 -2
  2. package/lib/cdk-lambda-subminute.js +3 -3
  3. package/node_modules/get-intrinsic/CHANGELOG.md +8 -0
  4. package/node_modules/get-intrinsic/index.js +10 -5
  5. package/node_modules/get-intrinsic/package.json +5 -5
  6. package/node_modules/get-proto/.eslintrc +10 -0
  7. package/node_modules/get-proto/.github/FUNDING.yml +12 -0
  8. package/node_modules/get-proto/.nycrc +9 -0
  9. package/node_modules/get-proto/CHANGELOG.md +21 -0
  10. package/node_modules/get-proto/LICENSE +21 -0
  11. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  12. package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  13. package/node_modules/get-proto/README.md +50 -0
  14. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  15. package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  16. package/node_modules/get-proto/index.d.ts +5 -0
  17. package/node_modules/get-proto/index.js +27 -0
  18. package/node_modules/get-proto/package.json +81 -0
  19. package/node_modules/get-proto/test/index.js +68 -0
  20. package/node_modules/get-proto/tsconfig.json +9 -0
  21. package/node_modules/is-generator-function/.eslintrc +1 -1
  22. package/node_modules/is-generator-function/CHANGELOG.md +21 -0
  23. package/node_modules/is-generator-function/index.d.ts +3 -0
  24. package/node_modules/is-generator-function/index.js +16 -7
  25. package/node_modules/is-generator-function/package.json +30 -11
  26. package/node_modules/is-generator-function/test/corejs.js +1 -0
  27. package/node_modules/is-generator-function/test/index.js +4 -7
  28. package/node_modules/is-generator-function/test/uglified.js +1 -0
  29. package/node_modules/is-generator-function/tsconfig.json +9 -0
  30. package/node_modules/is-regex/.editorconfig +23 -0
  31. package/node_modules/is-regex/.eslintrc +10 -0
  32. package/node_modules/is-regex/.nycrc +10 -0
  33. package/node_modules/is-regex/CHANGELOG.md +233 -0
  34. package/node_modules/is-regex/LICENSE +20 -0
  35. package/node_modules/is-regex/README.md +52 -0
  36. package/node_modules/is-regex/index.d.ts +3 -0
  37. package/node_modules/is-regex/index.js +69 -0
  38. package/node_modules/is-regex/package.json +104 -0
  39. package/node_modules/is-regex/test/index.js +121 -0
  40. package/node_modules/is-regex/tsconfig.json +9 -0
  41. package/node_modules/safe-regex-test/.eslintrc +9 -0
  42. package/node_modules/safe-regex-test/.github/FUNDING.yml +12 -0
  43. package/node_modules/safe-regex-test/.nycrc +13 -0
  44. package/node_modules/safe-regex-test/CHANGELOG.md +55 -0
  45. package/node_modules/safe-regex-test/LICENSE +21 -0
  46. package/node_modules/safe-regex-test/README.md +46 -0
  47. package/node_modules/safe-regex-test/index.d.ts +3 -0
  48. package/node_modules/safe-regex-test/index.js +17 -0
  49. package/node_modules/safe-regex-test/package.json +87 -0
  50. package/node_modules/safe-regex-test/test/index.js +41 -0
  51. package/node_modules/safe-regex-test/tsconfig.json +9 -0
  52. package/package.json +2 -2
  53. package/node_modules/is-generator-function/.eslintignore +0 -1
@@ -0,0 +1,104 @@
1
+ {
2
+ "name": "is-regex",
3
+ "version": "1.2.1",
4
+ "description": "Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag",
5
+ "author": "Jordan Harband <ljharb@gmail.com>",
6
+ "funding": {
7
+ "url": "https://github.com/sponsors/ljharb"
8
+ },
9
+ "license": "MIT",
10
+ "main": "index.js",
11
+ "scripts": {
12
+ "prepack": "npmignore --auto --commentLines=autogenerated",
13
+ "prepublishOnly": "safe-publish-latest",
14
+ "prepublish": "not-in-publish || npm run prepublishOnly",
15
+ "pretest": "npm run lint",
16
+ "test": "npm run tests-only && npm run test:harmony",
17
+ "tests-only": "nyc node test",
18
+ "test:harmony": "nyc node --harmony --es-staging test",
19
+ "test:corejs": "nyc tape test-corejs.js",
20
+ "posttest": "npx npm@'>=10.2' audit --production",
21
+ "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
22
+ "lint": "eslint --ext=js,mjs .",
23
+ "postlint": "tsc -p . && attw -P",
24
+ "version": "auto-changelog && git add CHANGELOG.md",
25
+ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git://github.com/inspect-js/is-regex.git"
30
+ },
31
+ "bugs": {
32
+ "url": "https://github.com/inspect-js/is-regex/issues"
33
+ },
34
+ "homepage": "https://github.com/inspect-js/is-regex",
35
+ "keywords": [
36
+ "regex",
37
+ "regexp",
38
+ "is",
39
+ "regular expression",
40
+ "regular",
41
+ "expression"
42
+ ],
43
+ "dependencies": {
44
+ "call-bound": "^1.0.2",
45
+ "gopd": "^1.2.0",
46
+ "has-tostringtag": "^1.0.2",
47
+ "hasown": "^2.0.2"
48
+ },
49
+ "devDependencies": {
50
+ "@arethetypeswrong/cli": "^0.17.1",
51
+ "@ljharb/eslint-config": "^21.1.1",
52
+ "@ljharb/tsconfig": "^0.2.2",
53
+ "@types/core-js": "^2.5.8",
54
+ "@types/for-each": "^0.3.3",
55
+ "@types/tape": "^5.6.5",
56
+ "auto-changelog": "^2.5.0",
57
+ "core-js": "^3.39.0",
58
+ "eclint": "^2.8.1",
59
+ "encoding": "^0.1.13",
60
+ "eslint": "=8.8.0",
61
+ "for-each": "^0.3.3",
62
+ "in-publish": "^2.0.1",
63
+ "npmignore": "^0.3.1",
64
+ "nyc": "^10.3.2",
65
+ "safe-publish-latest": "^2.0.0",
66
+ "tape": "^5.9.0",
67
+ "typescript": "^5.8.0-dev.20241129"
68
+ },
69
+ "testling": {
70
+ "files": "test/index.js",
71
+ "browsers": [
72
+ "iexplore/6.0..latest",
73
+ "firefox/3.0..6.0",
74
+ "firefox/15.0..latest",
75
+ "firefox/nightly",
76
+ "chrome/4.0..10.0",
77
+ "chrome/20.0..latest",
78
+ "chrome/canary",
79
+ "opera/10.0..latest",
80
+ "opera/next",
81
+ "safari/4.0..latest",
82
+ "ipad/6.0..latest",
83
+ "iphone/6.0..latest",
84
+ "android-browser/4.2"
85
+ ]
86
+ },
87
+ "engines": {
88
+ "node": ">= 0.4"
89
+ },
90
+ "auto-changelog": {
91
+ "output": "CHANGELOG.md",
92
+ "template": "keepachangelog",
93
+ "unreleased": false,
94
+ "commitLimit": false,
95
+ "backfillLimit": false,
96
+ "hideCredit": true
97
+ },
98
+ "publishConfig": {
99
+ "ignore": [
100
+ ".github/workflows",
101
+ "test-corejs.js"
102
+ ]
103
+ }
104
+ }
@@ -0,0 +1,121 @@
1
+ 'use strict';
2
+
3
+ var hasToStringTag = require('has-tostringtag/shams')();
4
+ var forEach = require('for-each');
5
+ var test = require('tape');
6
+ var isRegex = require('..');
7
+
8
+ test('not regexes', function (t) {
9
+ // @ts-expect-error
10
+ t.notOk(isRegex(), 'undefined is not regex');
11
+ t.notOk(isRegex(null), 'null is not regex');
12
+ t.notOk(isRegex(false), 'false is not regex');
13
+ t.notOk(isRegex(true), 'true is not regex');
14
+ t.notOk(isRegex(42), 'number is not regex');
15
+ t.notOk(isRegex('foo'), 'string is not regex');
16
+ t.notOk(isRegex([]), 'array is not regex');
17
+ t.notOk(isRegex({}), 'object is not regex');
18
+ t.notOk(isRegex(function () {}), 'function is not regex');
19
+ t.end();
20
+ });
21
+
22
+ test('@@toStringTag', { skip: !hasToStringTag }, function (t) {
23
+ var regex = /a/g;
24
+ /** @type {{ toString(): string, valueOf(): RegExp, [Symbol.toStringTag]?: string}} */
25
+ var fakeRegex = {
26
+ toString: function () { return String(regex); },
27
+ valueOf: function () { return regex; }
28
+ };
29
+ fakeRegex[Symbol.toStringTag] = 'RegExp';
30
+ t.notOk(isRegex(fakeRegex), 'fake RegExp with @@toStringTag "RegExp" is not regex');
31
+ t.end();
32
+ });
33
+
34
+ test('regexes', function (t) {
35
+ t.ok(isRegex(/a/g), 'regex literal is regex');
36
+ t.ok(isRegex(new RegExp('a', 'g')), 'regex object is regex');
37
+ t.end();
38
+ });
39
+
40
+ test('does not mutate regexes', function (t) {
41
+ t.test('lastIndex is a marker object', function (st) {
42
+ var regex = /a/;
43
+ var marker = {};
44
+ // @ts-expect-error
45
+ regex.lastIndex = marker;
46
+ st.equal(regex.lastIndex, marker, 'lastIndex is the marker object');
47
+ st.ok(isRegex(regex), 'is regex');
48
+ st.equal(regex.lastIndex, marker, 'lastIndex is the marker object after isRegex');
49
+ st.end();
50
+ });
51
+
52
+ t.test('lastIndex is nonzero', function (st) {
53
+ var regex = /a/;
54
+ regex.lastIndex = 3;
55
+ st.equal(regex.lastIndex, 3, 'lastIndex is 3');
56
+ st.ok(isRegex(regex), 'is regex');
57
+ st.equal(regex.lastIndex, 3, 'lastIndex is 3 after isRegex');
58
+ st.end();
59
+ });
60
+
61
+ t.end();
62
+ });
63
+
64
+ test('does not perform operations observable to Proxies', { skip: typeof Proxy !== 'function' }, function (t) {
65
+ /** @constructor */
66
+ function Handler() {
67
+ /** @type (keyof Reflect)[]} */
68
+ this.trapCalls = [];
69
+ }
70
+
71
+ // eslint-disable-next-line no-extra-parens
72
+ forEach(/** @const @type {(keyof Reflect)[]} */ ([
73
+ 'defineProperty',
74
+ 'deleteProperty',
75
+ 'get',
76
+ 'getOwnPropertyDescriptor',
77
+ 'getPrototypeOf',
78
+ 'has',
79
+ 'isExtensible',
80
+ 'ownKeys',
81
+ 'preventExtensions',
82
+ 'set',
83
+ 'setPrototypeOf'
84
+ ]), function (trapName) {
85
+ Handler.prototype[trapName] = function () {
86
+ this.trapCalls.push(trapName);
87
+ // @ts-expect-error TODO: not sure why this is erroring
88
+ return Reflect[trapName].apply(Reflect, arguments);
89
+ };
90
+ });
91
+
92
+ t.test('proxy of object', function (st) {
93
+ var handler = new Handler();
94
+ // @ts-expect-error Proxy handlers can be any object
95
+ var proxy = new Proxy({ lastIndex: 0 }, handler);
96
+
97
+ st.equal(isRegex(proxy), false, 'proxy of plain object is not regex');
98
+ st.deepEqual(
99
+ handler.trapCalls,
100
+ handler.trapCalls.length > 0 ? ['getOwnPropertyDescriptor'] : [],
101
+ 'no unexpected proxy traps were triggered'
102
+ );
103
+ st.end();
104
+ });
105
+
106
+ t.test('proxy of RegExp instance', function (st) {
107
+ var handler = new Handler();
108
+ // @ts-expect-error Proxy handlers can be any object
109
+ var proxy = new Proxy(/a/, handler);
110
+
111
+ st.equal(isRegex(proxy), false, 'proxy of RegExp instance is not regex');
112
+ st.deepEqual(
113
+ handler.trapCalls,
114
+ handler.trapCalls.length > 0 ? ['getOwnPropertyDescriptor'] : [],
115
+ 'no unexpected proxy traps were triggered'
116
+ );
117
+ st.end();
118
+ });
119
+
120
+ t.end();
121
+ });
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@ljharb/tsconfig",
3
+ "compilerOptions": {
4
+ "target": "ES2021",
5
+ },
6
+ "exclude": [
7
+ "coverage"
8
+ ]
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "root": true,
3
+
4
+ "extends": "@ljharb",
5
+
6
+ "rules": {
7
+ "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }],
8
+ },
9
+ }
@@ -0,0 +1,12 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [ljharb]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: npm/safe-regex-test
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,13 @@
1
+ {
2
+ "all": true,
3
+ "check-coverage": false,
4
+ "reporter": ["text-summary", "text", "html", "json"],
5
+ "lines": 86,
6
+ "statements": 85.93,
7
+ "functions": 82.43,
8
+ "branches": 76.06,
9
+ "exclude": [
10
+ "coverage",
11
+ "test"
12
+ ]
13
+ }
@@ -0,0 +1,55 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [v1.1.0](https://github.com/ljharb/safe-regex-test/compare/v1.0.3...v1.1.0) - 2024-12-12
9
+
10
+ ### Commits
11
+
12
+ - [actions] split out node 10-20, and 20+ [`b4a46bb`](https://github.com/ljharb/safe-regex-test/commit/b4a46bb30542251df8051aec52561ce2bb162f85)
13
+ - [New] add types [`5cb24eb`](https://github.com/ljharb/safe-regex-test/commit/5cb24eb6d074fdae200446e172f1ab485460c34e)
14
+ - [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `es-value-fixtures`, `object-inspect`, `tape` [`e225ca0`](https://github.com/ljharb/safe-regex-test/commit/e225ca081b77ea105b5e913a00473066efeb471d)
15
+ - [Refactor] use `call-bound` directly [`9be3cd2`](https://github.com/ljharb/safe-regex-test/commit/9be3cd2f390f23c0075ec93e5abdace0ee5d9d9d)
16
+ - [Deps] update `call-bind`, `is-regex` [`524b736`](https://github.com/ljharb/safe-regex-test/commit/524b73677e16de9dde27dfb8f30ac4760071bbda)
17
+ - [Tests] replace `aud` with `npm audit` [`f3cd537`](https://github.com/ljharb/safe-regex-test/commit/f3cd5379e48152daeb51fdd09e15d3ec74797761)
18
+ - [Dev Deps] add missing peer dep [`14da559`](https://github.com/ljharb/safe-regex-test/commit/14da559a0620b99a262ab9610dba13720915360f)
19
+
20
+ ## [v1.0.3](https://github.com/ljharb/safe-regex-test/compare/v1.0.2...v1.0.3) - 2024-02-06
21
+
22
+ ### Commits
23
+
24
+ - [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`d6ba2f9`](https://github.com/ljharb/safe-regex-test/commit/d6ba2f948c679c3104ce6d6c897bedff0f1c5b74)
25
+ - [Deps] update `call-bind`, `get-intrinsic` [`5a3b1d7`](https://github.com/ljharb/safe-regex-test/commit/5a3b1d755e46f010e6930f15ec30eae023feffd3)
26
+ - [Dev Deps] update `tape` [`75fb719`](https://github.com/ljharb/safe-regex-test/commit/75fb71937c5daf1326052c59d6f251f439cd9332)
27
+
28
+ ## [v1.0.2](https://github.com/ljharb/safe-regex-test/compare/v1.0.1...v1.0.2) - 2024-01-11
29
+
30
+ ### Commits
31
+
32
+ - [meta] package.json `sideEffects` should be boolean [`094bb88`](https://github.com/ljharb/safe-regex-test/commit/094bb88d93ce25e26d20f5badee4e45acf0e3ac5)
33
+
34
+ ## [v1.0.1](https://github.com/ljharb/safe-regex-test/compare/v1.0.0...v1.0.1) - 2024-01-09
35
+
36
+ ### Commits
37
+
38
+ - [Tests] add nyc for coverage [`7e3f525`](https://github.com/ljharb/safe-regex-test/commit/7e3f5254efdf0979f72492f0e7f52a3a9814591f)
39
+ - [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `object-inspect`, `tape` [`e7e0169`](https://github.com/ljharb/safe-regex-test/commit/e7e016949b78602f24debc1185c26f33cc4e9d1b)
40
+ - [actions] update rebase action [`2962694`](https://github.com/ljharb/safe-regex-test/commit/2962694bce7ffa278e873911072c11119bb3a608)
41
+ - [readme] add testing badges; remove david-dm badges [`e9dfd83`](https://github.com/ljharb/safe-regex-test/commit/e9dfd830655ac702ac7b7947f7076bb524994968)
42
+ - [Dev Deps] update `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`496fe99`](https://github.com/ljharb/safe-regex-test/commit/496fe99aa66f20cadb1cf79f6d479b87ae95b620)
43
+ - [Deps] update `call-bind`, `get-intrinsic` [`d94c5ba`](https://github.com/ljharb/safe-regex-test/commit/d94c5badd0362df8ff7ced38b50d20550fd629c1)
44
+ - [meta] add missing `engines.node` [`f3d4711`](https://github.com/ljharb/safe-regex-test/commit/f3d4711a51b21330e34f5f27e45452fbdb924715)
45
+ - [Deps] update `get-intrinsic` [`0eeedd7`](https://github.com/ljharb/safe-regex-test/commit/0eeedd74d0313fab9b0718895c02905f702ecb4d)
46
+ - [meta] add `sideEffects` flag [`fe1655f`](https://github.com/ljharb/safe-regex-test/commit/fe1655f16449208d987d9f4b7dafb15564ca80f7)
47
+
48
+ ## v1.0.0 - 2022-09-22
49
+
50
+ ### Commits
51
+
52
+ - Initial implementation, tests, readme [`0273e9f`](https://github.com/ljharb/safe-regex-test/commit/0273e9f96f4b09df413523f4faacc8ae9ac5e6cb)
53
+ - Initial commit [`b6c1edf`](https://github.com/ljharb/safe-regex-test/commit/b6c1edf740e6105fb71c34c1c69fadd837e8f7ab)
54
+ - npm init [`c7f5765`](https://github.com/ljharb/safe-regex-test/commit/c7f576580607b16458b5a16e6bfa3b639e49c6bd)
55
+ - Only apps should have lockfiles [`1162bf0`](https://github.com/ljharb/safe-regex-test/commit/1162bf011835040f7e2c9936734294b2d98536bf)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Jordan Harband
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,46 @@
1
+ # safe-regex-test <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
2
+
3
+ [![github actions][actions-image]][actions-url]
4
+ [![coverage][codecov-image]][codecov-url]
5
+ [![License][license-image]][license-url]
6
+ [![Downloads][downloads-image]][downloads-url]
7
+
8
+ [![npm badge][npm-badge-png]][package-url]
9
+
10
+ Give a regex, get a robust predicate function that tests it against a string. This will work even if `RegExp.prototype` is altered later.
11
+
12
+ ## Getting started
13
+
14
+ ```sh
15
+ npm install --save safe-regex-test
16
+ ```
17
+
18
+ ## Usage/Examples
19
+
20
+ ```js
21
+ var regexTester = require('safe-regex-test');
22
+ var assert = require('assert');
23
+
24
+ var tester = regexTester('a');
25
+ assert.ok(tester('a'));
26
+ assert.notOk(tester('b'));
27
+ ```
28
+
29
+ ## Tests
30
+ Simply clone the repo, `npm install`, and run `npm test`
31
+
32
+ [package-url]: https://npmjs.org/package/safe-regex-test
33
+ [npm-version-svg]: https://versionbadg.es/ljharb/safe-regex-test.svg
34
+ [deps-svg]: https://david-dm.org/ljharb/safe-regex-test.svg
35
+ [deps-url]: https://david-dm.org/ljharb/safe-regex-test
36
+ [dev-deps-svg]: https://david-dm.org/ljharb/safe-regex-test/dev-status.svg
37
+ [dev-deps-url]: https://david-dm.org/ljharb/safe-regex-test#info=devDependencies
38
+ [npm-badge-png]: https://nodei.co/npm/safe-regex-test.png?downloads=true&stars=true
39
+ [license-image]: https://img.shields.io/npm/l/safe-regex-test.svg
40
+ [license-url]: LICENSE
41
+ [downloads-image]: https://img.shields.io/npm/dm/safe-regex-test.svg
42
+ [downloads-url]: https://npm-stat.com/charts.html?package=safe-regex-test
43
+ [codecov-image]: https://codecov.io/gh/ljharb/safe-regex-test/branch/main/graphs/badge.svg
44
+ [codecov-url]: https://app.codecov.io/gh/ljharb/safe-regex-test/
45
+ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/safe-regex-test
46
+ [actions-url]: https://github.com/ljharb/safe-regex-test/actions
@@ -0,0 +1,3 @@
1
+ declare function regexTester(regex: RegExp): (string: string) => boolean;
2
+
3
+ export = regexTester;
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ var callBound = require('call-bound');
4
+ var isRegex = require('is-regex');
5
+
6
+ var $exec = callBound('RegExp.prototype.exec');
7
+ var $TypeError = require('es-errors/type');
8
+
9
+ /** @type {import('.')} */
10
+ module.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
+ };
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "safe-regex-test",
3
+ "version": "1.1.0",
4
+ "description": "Give a regex, get a robust predicate function that tests it against a string.",
5
+ "main": "index.js",
6
+ "exports": {
7
+ ".": "./index.js",
8
+ "./package.json": "./package.json"
9
+ },
10
+ "sideEffects": false,
11
+ "scripts": {
12
+ "prepack": "npmignore --auto --commentLines=autogenerated",
13
+ "version": "auto-changelog && git add CHANGELOG.md",
14
+ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"",
15
+ "lint": "eslint --ext=js,mjs .",
16
+ "postlint": "tsc && attw -P",
17
+ "prepublish": "not-in-publish || npm run prepublishOnly",
18
+ "prepublishOnly": "safe-publish-latest",
19
+ "pretest": "npm run lint",
20
+ "tests-only": "nyc tape test",
21
+ "test": "npm run tests-only",
22
+ "posttest": "npx npm@'>= 10.2' audit --production"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/ljharb/safe-regex-test.git"
27
+ },
28
+ "keywords": [
29
+ "regex",
30
+ "regexp",
31
+ "test",
32
+ "tester",
33
+ "safe",
34
+ "robust",
35
+ "exec"
36
+ ],
37
+ "author": "Jordan Harband <ljharb@gmail.com>",
38
+ "funding": {
39
+ "url": "https://github.com/sponsors/ljharb"
40
+ },
41
+ "license": "MIT",
42
+ "bugs": {
43
+ "url": "https://github.com/ljharb/safe-regex-test/issues"
44
+ },
45
+ "homepage": "https://github.com/ljharb/safe-regex-test#readme",
46
+ "dependencies": {
47
+ "call-bound": "^1.0.2",
48
+ "es-errors": "^1.3.0",
49
+ "is-regex": "^1.2.1"
50
+ },
51
+ "devDependencies": {
52
+ "@arethetypeswrong/cli": "^0.17.1",
53
+ "@ljharb/eslint-config": "^21.1.1",
54
+ "@ljharb/tsconfig": "^0.2.2",
55
+ "@types/for-each": "^0.3.3",
56
+ "@types/object-inspect": "^1.13.0",
57
+ "@types/tape": "^5.6.5",
58
+ "auto-changelog": "^2.5.0",
59
+ "encoding": "^0.1.13",
60
+ "es-value-fixtures": "^1.5.0",
61
+ "eslint": "=8.8.0",
62
+ "for-each": "^0.3.3",
63
+ "in-publish": "^2.0.1",
64
+ "npmignore": "^0.3.1",
65
+ "nyc": "^10.3.2",
66
+ "object-inspect": "^1.13.3",
67
+ "safe-publish-latest": "^2.0.0",
68
+ "tape": "^5.9.0",
69
+ "typescript": "next"
70
+ },
71
+ "auto-changelog": {
72
+ "output": "CHANGELOG.md",
73
+ "template": "keepachangelog",
74
+ "unreleased": false,
75
+ "commitLimit": false,
76
+ "backfillLimit": false,
77
+ "hideCredit": true
78
+ },
79
+ "publishConfig": {
80
+ "ignore": [
81
+ ".github/workflows"
82
+ ]
83
+ },
84
+ "engines": {
85
+ "node": ">= 0.4"
86
+ }
87
+ }
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ var test = require('tape');
4
+ var v = require('es-value-fixtures');
5
+ var forEach = require('for-each');
6
+ var inspect = require('object-inspect');
7
+
8
+ var regexTester = require('../');
9
+
10
+ test('regex tester', function (t) {
11
+ t.equal(typeof regexTester, 'function', 'is a function');
12
+
13
+ t.test('non-regexes', function (st) {
14
+ forEach([].concat(
15
+ // @ts-expect-error TS sucks with concat
16
+ v.primitives,
17
+ v.objects
18
+ ), function (val) {
19
+ st['throws'](
20
+ function () { regexTester(val); },
21
+ TypeError,
22
+ inspect(val) + ' is not a regex'
23
+ );
24
+ });
25
+
26
+ st.end();
27
+ });
28
+
29
+ t.test('regexes', function (st) {
30
+ var tester = regexTester(/a/);
31
+
32
+ st.equal(typeof tester, 'function', 'returns a function');
33
+ st.equal(tester('a'), true, 'returns true for a match');
34
+ st.equal(tester('b'), false, 'returns false for a non-match');
35
+ st.equal(tester('a'), true, 'returns true for a match again');
36
+
37
+ st.end();
38
+ });
39
+
40
+ t.end();
41
+ });
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@ljharb/tsconfig",
3
+ "compilerOptions": {
4
+ // "target": "es2021",
5
+ },
6
+ "exclude": [
7
+ "coverage",
8
+ ],
9
+ }
package/package.json CHANGED
@@ -57,7 +57,7 @@
57
57
  "jsii-docgen": "^10.5.0",
58
58
  "jsii-pacmak": "^1.106.0",
59
59
  "jsii-rosetta": "5.4.x",
60
- "projen": "^0.91.4",
60
+ "projen": "^0.91.5",
61
61
  "source-map-support": "^0.5.21",
62
62
  "ts-jest": "^27",
63
63
  "typescript": "^4.9.5"
@@ -91,7 +91,7 @@
91
91
  "publishConfig": {
92
92
  "access": "public"
93
93
  },
94
- "version": "2.0.576",
94
+ "version": "2.0.578",
95
95
  "jest": {
96
96
  "coverageProvider": "v8",
97
97
  "testMatch": [
@@ -1 +0,0 @@
1
- coverage/