regexp-support
Advanced tools
@@ -6,2 +6,62 @@ # Change Log | ||
## [1.0.34](https://github.com/bluelovers/regexp-support/compare/regexp-support@1.0.31...regexp-support@1.0.34) (2021-06-21) | ||
### ✨ Features | ||
* check indices ([3876980](https://github.com/bluelovers/regexp-support/commit/38769806b0b8d24b12cbe4ab5d8d75ea066902ad)) | ||
### 💎 Styles | ||
* use importHelpers ([6bedeef](https://github.com/bluelovers/regexp-support/commit/6bedeefcb325c049cbdfaf3ba3fc3afa7140893d)) | ||
### 🔖 Miscellaneous | ||
* . ([04dabaf](https://github.com/bluelovers/regexp-support/commit/04dabafe09304920fd61a12cf739d2364f4417a8)) | ||
* . ([2fc9875](https://github.com/bluelovers/regexp-support/commit/2fc9875ea48136c70e1dee845d4e1b14eca184a9)) | ||
* . ([bc27d71](https://github.com/bluelovers/regexp-support/commit/bc27d71024cd06e308b59ba93b08dec6d074996b)) | ||
## [1.0.33](https://github.com/bluelovers/regexp-support/compare/regexp-support@1.0.31...regexp-support@1.0.33) (2021-06-21) | ||
### ✨ Features | ||
* check indices ([3876980](https://github.com/bluelovers/regexp-support/commit/38769806b0b8d24b12cbe4ab5d8d75ea066902ad)) | ||
### 💎 Styles | ||
* use importHelpers ([6bedeef](https://github.com/bluelovers/regexp-support/commit/6bedeefcb325c049cbdfaf3ba3fc3afa7140893d)) | ||
### 🔖 Miscellaneous | ||
* . ([bc27d71](https://github.com/bluelovers/regexp-support/commit/bc27d71024cd06e308b59ba93b08dec6d074996b)) | ||
## [1.0.32](https://github.com/bluelovers/regexp-support/compare/regexp-support@1.0.31...regexp-support@1.0.32) (2021-06-21) | ||
### ✨ Features | ||
* check indices ([3876980](https://github.com/bluelovers/regexp-support/commit/38769806b0b8d24b12cbe4ab5d8d75ea066902ad)) | ||
### 💎 Styles | ||
* use importHelpers ([6bedeef](https://github.com/bluelovers/regexp-support/commit/6bedeefcb325c049cbdfaf3ba3fc3afa7140893d)) | ||
## [1.0.31](https://github.com/bluelovers/regexp-support/compare/regexp-support@1.0.29...regexp-support@1.0.31) (2020-07-19) | ||
@@ -8,0 +68,0 @@ |
@@ -29,2 +29,4 @@ /** | ||
readonly x: boolean; | ||
readonly indices: boolean; | ||
readonly d: boolean; | ||
readonly n: boolean; | ||
@@ -63,2 +65,3 @@ }; | ||
readonly dotAll?: boolean; | ||
readonly hasIndices?: boolean; | ||
exec?: boolean; | ||
@@ -75,2 +78,6 @@ test?: boolean; | ||
readonly unicode?: boolean; | ||
[Symbol.match]?: boolean; | ||
[Symbol.replace]?: boolean; | ||
[Symbol.search]?: boolean; | ||
[Symbol.split]?: boolean; | ||
}; | ||
@@ -100,2 +107,3 @@ static: { | ||
'$\''?: boolean; | ||
readonly [Symbol.species]?: boolean; | ||
}; | ||
@@ -102,0 +110,0 @@ symbol: { |
@@ -32,2 +32,4 @@ /** | ||
x = "x", | ||
indices = "d", | ||
d = "d", | ||
n = "n" | ||
@@ -34,0 +36,0 @@ } |
@@ -38,2 +38,4 @@ "use strict"; | ||
FlagsName["x"] = "x"; | ||
FlagsName["indices"] = "d"; | ||
FlagsName["d"] = "d"; | ||
FlagsName["n"] = "n"; | ||
@@ -51,4 +53,20 @@ })(FlagsName = exports.FlagsName || (exports.FlagsName = {})); | ||
], | ||
d: [ | ||
[ | ||
'a+(?<Z>z)?', 'xaaaz', null, (re, value, input, pattern, RegExpClass, flag, ...argv) => { | ||
let ret = re.exec(input); | ||
if (ret.indices[0][0] === 1 | ||
&& ret.indices[0][1] === 5 | ||
&& ret.indices[1][0] === 4 | ||
&& ret.indices[1][1] === 5 | ||
&& ret.indices.groups.Z[0] === 4 | ||
&& ret.indices.groups.Z[1] === 5) { | ||
return true; | ||
} | ||
return false; | ||
}, | ||
], | ||
], | ||
}; | ||
exports.default = FlagsName; | ||
//# sourceMappingURL=flags.js.map |
@@ -5,24 +5,6 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createRegExp = exports.testFlagsAll = exports.testFlag = exports.hasSupportFlag = exports.FlagsName = void 0; | ||
const flags_1 = __importStar(require("./flags")); | ||
const tslib_1 = require("tslib"); | ||
const flags_1 = tslib_1.__importStar(require("./flags")); | ||
exports.FlagsName = flags_1.default; | ||
@@ -59,13 +41,18 @@ /** | ||
let bool; | ||
let r = createRegExp(pattern, flag, RegExpClass); | ||
if (fn) { | ||
if (typeof fn == 'function') { | ||
bool = fn(r, value, input, pattern, RegExpClass, flag); | ||
try { | ||
let r = createRegExp(pattern, flag, RegExpClass); | ||
if (fn) { | ||
if (typeof fn == 'function') { | ||
bool = fn(r, value, input, pattern, RegExpClass, flag); | ||
} | ||
else { | ||
bool = r[fn](input) === value; | ||
} | ||
} | ||
else { | ||
bool = r[fn](input) === value; | ||
bool = r.test(input) === value; | ||
} | ||
} | ||
else { | ||
bool = r.test(input) === value; | ||
catch (e) { | ||
return false; | ||
} | ||
@@ -72,0 +59,0 @@ return bool; |
@@ -5,10 +5,8 @@ "use strict"; | ||
*/ | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.wrapToRegexName = exports.testUnicodeBlocksAll = exports.testUnicodeBlocks = exports.PatternTest = exports.UNICODE_BLOCKS_ALL = exports.UNICODE_BLOCKS = exports.KEY_SUFFIX = exports.KEY_PREFIX_NEGATION = exports.KEY_PREFIX = void 0; | ||
const tslib_1 = require("tslib"); | ||
const index_1 = require("../../util/index"); | ||
const index_2 = require("./index"); | ||
const blocks_1 = __importDefault(require("../cache/blocks")); | ||
const blocks_1 = tslib_1.__importDefault(require("../cache/blocks")); | ||
exports.KEY_PREFIX = '\\p{'; | ||
@@ -15,0 +13,0 @@ exports.KEY_PREFIX_NEGATION = '\\P{'; |
@@ -5,11 +5,9 @@ "use strict"; | ||
*/ | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.wrapToRegexName = exports.testUnicodeScriptAll = exports.testUnicodeScript = exports._testUnicodeScript = exports.PatternTest = exports.UNICODE_SCRIPTS_NAME_ALIAS = exports.UNICODE_SCRIPTS_ALL = exports.UNICODE_SCRIPTS = exports.KEY_SUFFIX = exports.KEY_PREFIX_NEGATION = exports.KEY_PREFIX = void 0; | ||
const property_data_1 = __importDefault(require("../cache/property-data")); | ||
const tslib_1 = require("tslib"); | ||
const property_data_1 = tslib_1.__importDefault(require("../cache/property-data")); | ||
const index_1 = require("../../util/index"); | ||
const index_2 = require("./index"); | ||
const scripts_1 = __importDefault(require("../cache/scripts")); | ||
const scripts_1 = tslib_1.__importDefault(require("../cache/scripts")); | ||
exports.KEY_PREFIX = '\\p{Script='; | ||
@@ -16,0 +14,0 @@ exports.KEY_PREFIX_NEGATION = '\\P{Script='; |
@@ -5,31 +5,10 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.wrapToRegexName = exports.testUnicodeAll = exports.testUnicode = exports._testUnicode = exports.PatternTest = exports.UNICODE_NAME_ALIAS_ALL = exports.UNICODE_NAME_ALIAS = exports.UNICODE_ALL = exports.UNICODE = exports.KEY_SUFFIX = exports.KEY_PREFIX_NEGATION = exports.KEY_PREFIX = void 0; | ||
const tslib_1 = require("tslib"); | ||
const index_1 = require("../../util/index"); | ||
const index_2 = require("./index"); | ||
const categories_1 = __importStar(require("../cache/categories")); | ||
const properties_1 = __importDefault(require("../cache/properties")); | ||
const property_data_1 = __importDefault(require("../cache/property-data")); | ||
const categories_1 = tslib_1.__importStar(require("../cache/categories")); | ||
const properties_1 = tslib_1.__importDefault(require("../cache/properties")); | ||
const property_data_1 = tslib_1.__importDefault(require("../cache/property-data")); | ||
//console.log(properties); | ||
@@ -36,0 +15,0 @@ exports.KEY_PREFIX = '\\p{'; |
/** | ||
* Created by user on 2018/4/28/028. | ||
*/ | ||
/// <reference lib="es2015.core" /> | ||
/// <reference lib="es2015.symbol.wellknown" /> | ||
/// <reference lib="es2018.regexp" /> | ||
import { ITypeCreateRegExp } from '../index'; | ||
export interface IRegExpPrototype extends RegExp { | ||
readonly dotAll: boolean; | ||
readonly hasIndices: boolean; | ||
} | ||
export declare const PROTOTYPE: { | ||
readonly dotAll?: boolean; | ||
readonly hasIndices?: boolean; | ||
exec?: boolean; | ||
@@ -21,5 +26,10 @@ test?: boolean; | ||
readonly unicode?: boolean; | ||
[Symbol.match]?: boolean; | ||
[Symbol.replace]?: boolean; | ||
[Symbol.search]?: boolean; | ||
[Symbol.split]?: boolean; | ||
}; | ||
export declare function testPrototype<T>(RegExpClass?: ITypeCreateRegExp<T>): { | ||
readonly dotAll?: boolean; | ||
readonly hasIndices?: boolean; | ||
exec?: boolean; | ||
@@ -36,2 +46,6 @@ test?: boolean; | ||
readonly unicode?: boolean; | ||
[Symbol.match]?: boolean; | ||
[Symbol.replace]?: boolean; | ||
[Symbol.search]?: boolean; | ||
[Symbol.split]?: boolean; | ||
}; |
@@ -7,2 +7,5 @@ "use strict"; | ||
exports.testPrototype = exports.PROTOTYPE = void 0; | ||
/// <reference lib="es2015.core" /> | ||
/// <reference lib="es2015.symbol.wellknown" /> | ||
/// <reference lib="es2018.regexp" /> | ||
const index_1 = require("../index"); | ||
@@ -19,2 +22,3 @@ exports.PROTOTYPE = { | ||
unicode: false, | ||
hasIndices: false, | ||
}; | ||
@@ -21,0 +25,0 @@ // @ts-ignore |
@@ -5,2 +5,3 @@ /** | ||
/// <reference lib="es2015.core" /> | ||
/// <reference lib="es2015.symbol.wellknown" /> | ||
/// <reference lib="es2018.regexp" /> | ||
@@ -111,2 +112,3 @@ import { ITypeCreateRegExp } from '../index'; | ||
'$\''?: boolean; | ||
readonly [Symbol.species]?: boolean; | ||
}; | ||
@@ -136,3 +138,4 @@ export declare function testStatic<T>(RegExpClass?: ITypeCreateRegExp<T>): { | ||
'$\''?: boolean; | ||
readonly [Symbol.species]?: boolean; | ||
}; | ||
export {}; |
@@ -6,2 +6,3 @@ "use strict"; | ||
/// <reference lib="es2015.core" /> | ||
/// <reference lib="es2015.symbol.wellknown" /> | ||
/// <reference lib="es2018.regexp" /> | ||
@@ -8,0 +9,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
{ | ||
"name": "regexp-support", | ||
"version": "1.0.31", | ||
"version": "1.0.34", | ||
"description": "check RegExp ( regular expressions ) support", | ||
@@ -42,4 +42,5 @@ "keywords": [ | ||
"scripts": { | ||
"test": "node ./test/flags.js && jest -u", | ||
"prepublishOnly": "yarn run test", | ||
"test": "yarn run build:report && jest -u", | ||
"build:report": "node ./test/flags.js", | ||
"preversion": "yarn run test", | ||
"prepublishOnly:check-bin": "ynpx --quiet @yarn-tool/check-pkg-bin", | ||
@@ -51,3 +52,4 @@ "prepublishOnly:update": "yarn run ncu && yarn run sort-package-json", | ||
"dependencies": { | ||
"sort-object-keys2": "^2.0.3" | ||
"sort-object-keys2": "^2.0.3", | ||
"tslib": "^2.3.0" | ||
}, | ||
@@ -59,3 +61,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "c9a0537568a54bd4608ced691ae10fe0f8fc4824" | ||
"gitHead": "1aa0f123c804bfd33203716a9c7d11804c2e411e" | ||
} |
@@ -37,2 +37,4 @@ { | ||
"x": false, | ||
"indices": false, | ||
"d": false, | ||
"n": false | ||
@@ -71,3 +73,4 @@ }, | ||
"sticky": true, | ||
"unicode": true | ||
"unicode": true, | ||
"hasIndices": false | ||
}, | ||
@@ -74,0 +77,0 @@ "static": { |
27
v12.json
{ | ||
"versions": { | ||
"node": "12.3.1", | ||
"node": "12.16.2", | ||
"ares": "1.15.0", | ||
"brotli": "1.0.7", | ||
"cldr": "35.1", | ||
"http_parser": "2.8.0", | ||
"icu": "64.2", | ||
"llhttp": "1.1.3", | ||
"cldr": "36.0", | ||
"http_parser": "2.9.3", | ||
"icu": "65.1", | ||
"llhttp": "2.0.4", | ||
"modules": "72", | ||
"napi": "4", | ||
"nghttp2": "1.38.0", | ||
"openssl": "1.1.1b", | ||
"tz": "2019a", | ||
"napi": "5", | ||
"nghttp2": "1.40.0", | ||
"openssl": "1.1.1e", | ||
"tz": "2019c", | ||
"unicode": "12.1", | ||
"uv": "1.29.1", | ||
"v8": "7.4.288.27-node.18", | ||
"uv": "1.34.2", | ||
"v8": "7.8.279.23-node.34", | ||
"zlib": "1.2.11" | ||
@@ -37,2 +37,4 @@ }, | ||
"x": false, | ||
"indices": false, | ||
"d": false, | ||
"n": false | ||
@@ -71,3 +73,4 @@ }, | ||
"sticky": true, | ||
"unicode": true | ||
"unicode": true, | ||
"hasIndices": false | ||
}, | ||
@@ -74,0 +77,0 @@ "static": { |
29
v14.json
{ | ||
"versions": { | ||
"node": "14.5.0", | ||
"ares": "1.16.0", | ||
"brotli": "1.0.7", | ||
"cldr": "37.0", | ||
"icu": "67.1", | ||
"llhttp": "2.0.4", | ||
"node": "14.17.0", | ||
"ares": "1.17.1", | ||
"brotli": "1.0.9", | ||
"cldr": "38.1", | ||
"icu": "68.2", | ||
"llhttp": "2.1.3", | ||
"modules": "83", | ||
"napi": "6", | ||
"nghttp2": "1.41.0", | ||
"openssl": "1.1.1g", | ||
"tz": "2020a", | ||
"napi": "8", | ||
"nghttp2": "1.42.0", | ||
"openssl": "1.1.1k", | ||
"tz": "2020d", | ||
"unicode": "13.0", | ||
"uv": "1.38.0", | ||
"v8": "8.3.110.9-node.23", | ||
"uv": "1.41.0", | ||
"v8": "8.4.371.23-node.63", | ||
"zlib": "1.2.11" | ||
@@ -36,2 +36,4 @@ }, | ||
"x": false, | ||
"indices": false, | ||
"d": false, | ||
"n": false | ||
@@ -70,3 +72,4 @@ }, | ||
"sticky": true, | ||
"unicode": true | ||
"unicode": true, | ||
"hasIndices": false | ||
}, | ||
@@ -73,0 +76,0 @@ "static": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
499118
4.2%68
4.62%11753
6.69%2
100%