regexpu-core
Advanced tools
Comparing version 3.0.2 to 3.1.0
@@ -19,2 +19,3 @@ module.exports = new Map([ | ||
[0x1F2, 0x1F1], | ||
[0x26A, 0xA7AE], | ||
[0x29D, 0xA7B2], | ||
@@ -48,2 +49,19 @@ [0x345, 0x1FBE], | ||
[0x3F5, 0x395], | ||
[0x412, 0x1C80], | ||
[0x414, 0x1C81], | ||
[0x41E, 0x1C82], | ||
[0x421, 0x1C83], | ||
[0x422, 0x1C85], | ||
[0x42A, 0x1C86], | ||
[0x432, 0x1C80], | ||
[0x434, 0x1C81], | ||
[0x43E, 0x1C82], | ||
[0x441, 0x1C83], | ||
[0x442, [ | ||
0x1C84, | ||
0x1C85 | ||
]], | ||
[0x44A, 0x1C86], | ||
[0x462, 0x1C87], | ||
[0x463, 0x1C87], | ||
[0x13A0, 0xAB70], | ||
@@ -141,2 +159,39 @@ [0x13A1, 0xAB71], | ||
[0x13FD, 0x13F5], | ||
[0x1C80, [ | ||
0x412, | ||
0x432 | ||
]], | ||
[0x1C81, [ | ||
0x414, | ||
0x434 | ||
]], | ||
[0x1C82, [ | ||
0x41E, | ||
0x43E | ||
]], | ||
[0x1C83, [ | ||
0x421, | ||
0x441 | ||
]], | ||
[0x1C84, [ | ||
0x1C85, | ||
0x442 | ||
]], | ||
[0x1C85, [ | ||
0x422, | ||
0x1C84, | ||
0x442 | ||
]], | ||
[0x1C86, [ | ||
0x42A, | ||
0x44A | ||
]], | ||
[0x1C87, [ | ||
0x462, | ||
0x463 | ||
]], | ||
[0x1C88, [ | ||
0xA64A, | ||
0xA64B | ||
]], | ||
[0x1E60, 0x1E9B], | ||
@@ -212,2 +267,5 @@ [0x1E9B, 0x1E60], | ||
]], | ||
[0xA64A, 0x1C88], | ||
[0xA64B, 0x1C88], | ||
[0xA7AE, 0x26A], | ||
[0xA7B2, 0x29D], | ||
@@ -380,2 +438,74 @@ [0xA7B3, 0xAB53], | ||
[0x1044F, 0x10427], | ||
[0x104B0, 0x104D8], | ||
[0x104B1, 0x104D9], | ||
[0x104B2, 0x104DA], | ||
[0x104B3, 0x104DB], | ||
[0x104B4, 0x104DC], | ||
[0x104B5, 0x104DD], | ||
[0x104B6, 0x104DE], | ||
[0x104B7, 0x104DF], | ||
[0x104B8, 0x104E0], | ||
[0x104B9, 0x104E1], | ||
[0x104BA, 0x104E2], | ||
[0x104BB, 0x104E3], | ||
[0x104BC, 0x104E4], | ||
[0x104BD, 0x104E5], | ||
[0x104BE, 0x104E6], | ||
[0x104BF, 0x104E7], | ||
[0x104C0, 0x104E8], | ||
[0x104C1, 0x104E9], | ||
[0x104C2, 0x104EA], | ||
[0x104C3, 0x104EB], | ||
[0x104C4, 0x104EC], | ||
[0x104C5, 0x104ED], | ||
[0x104C6, 0x104EE], | ||
[0x104C7, 0x104EF], | ||
[0x104C8, 0x104F0], | ||
[0x104C9, 0x104F1], | ||
[0x104CA, 0x104F2], | ||
[0x104CB, 0x104F3], | ||
[0x104CC, 0x104F4], | ||
[0x104CD, 0x104F5], | ||
[0x104CE, 0x104F6], | ||
[0x104CF, 0x104F7], | ||
[0x104D0, 0x104F8], | ||
[0x104D1, 0x104F9], | ||
[0x104D2, 0x104FA], | ||
[0x104D3, 0x104FB], | ||
[0x104D8, 0x104B0], | ||
[0x104D9, 0x104B1], | ||
[0x104DA, 0x104B2], | ||
[0x104DB, 0x104B3], | ||
[0x104DC, 0x104B4], | ||
[0x104DD, 0x104B5], | ||
[0x104DE, 0x104B6], | ||
[0x104DF, 0x104B7], | ||
[0x104E0, 0x104B8], | ||
[0x104E1, 0x104B9], | ||
[0x104E2, 0x104BA], | ||
[0x104E3, 0x104BB], | ||
[0x104E4, 0x104BC], | ||
[0x104E5, 0x104BD], | ||
[0x104E6, 0x104BE], | ||
[0x104E7, 0x104BF], | ||
[0x104E8, 0x104C0], | ||
[0x104E9, 0x104C1], | ||
[0x104EA, 0x104C2], | ||
[0x104EB, 0x104C3], | ||
[0x104EC, 0x104C4], | ||
[0x104ED, 0x104C5], | ||
[0x104EE, 0x104C6], | ||
[0x104EF, 0x104C7], | ||
[0x104F0, 0x104C8], | ||
[0x104F1, 0x104C9], | ||
[0x104F2, 0x104CA], | ||
[0x104F3, 0x104CB], | ||
[0x104F4, 0x104CC], | ||
[0x104F5, 0x104CD], | ||
[0x104F6, 0x104CE], | ||
[0x104F7, 0x104CF], | ||
[0x104F8, 0x104D0], | ||
[0x104F9, 0x104D1], | ||
[0x104FA, 0x104D2], | ||
[0x104FB, 0x104D3], | ||
[0x10C80, 0x10CC0], | ||
@@ -546,3 +676,71 @@ [0x10C81, 0x10CC1], | ||
[0x118DE, 0x118BE], | ||
[0x118DF, 0x118BF] | ||
[0x118DF, 0x118BF], | ||
[0x1E900, 0x1E922], | ||
[0x1E901, 0x1E923], | ||
[0x1E902, 0x1E924], | ||
[0x1E903, 0x1E925], | ||
[0x1E904, 0x1E926], | ||
[0x1E905, 0x1E927], | ||
[0x1E906, 0x1E928], | ||
[0x1E907, 0x1E929], | ||
[0x1E908, 0x1E92A], | ||
[0x1E909, 0x1E92B], | ||
[0x1E90A, 0x1E92C], | ||
[0x1E90B, 0x1E92D], | ||
[0x1E90C, 0x1E92E], | ||
[0x1E90D, 0x1E92F], | ||
[0x1E90E, 0x1E930], | ||
[0x1E90F, 0x1E931], | ||
[0x1E910, 0x1E932], | ||
[0x1E911, 0x1E933], | ||
[0x1E912, 0x1E934], | ||
[0x1E913, 0x1E935], | ||
[0x1E914, 0x1E936], | ||
[0x1E915, 0x1E937], | ||
[0x1E916, 0x1E938], | ||
[0x1E917, 0x1E939], | ||
[0x1E918, 0x1E93A], | ||
[0x1E919, 0x1E93B], | ||
[0x1E91A, 0x1E93C], | ||
[0x1E91B, 0x1E93D], | ||
[0x1E91C, 0x1E93E], | ||
[0x1E91D, 0x1E93F], | ||
[0x1E91E, 0x1E940], | ||
[0x1E91F, 0x1E941], | ||
[0x1E920, 0x1E942], | ||
[0x1E921, 0x1E943], | ||
[0x1E922, 0x1E900], | ||
[0x1E923, 0x1E901], | ||
[0x1E924, 0x1E902], | ||
[0x1E925, 0x1E903], | ||
[0x1E926, 0x1E904], | ||
[0x1E927, 0x1E905], | ||
[0x1E928, 0x1E906], | ||
[0x1E929, 0x1E907], | ||
[0x1E92A, 0x1E908], | ||
[0x1E92B, 0x1E909], | ||
[0x1E92C, 0x1E90A], | ||
[0x1E92D, 0x1E90B], | ||
[0x1E92E, 0x1E90C], | ||
[0x1E92F, 0x1E90D], | ||
[0x1E930, 0x1E90E], | ||
[0x1E931, 0x1E90F], | ||
[0x1E932, 0x1E910], | ||
[0x1E933, 0x1E911], | ||
[0x1E934, 0x1E912], | ||
[0x1E935, 0x1E913], | ||
[0x1E936, 0x1E914], | ||
[0x1E937, 0x1E915], | ||
[0x1E938, 0x1E916], | ||
[0x1E939, 0x1E917], | ||
[0x1E93A, 0x1E918], | ||
[0x1E93B, 0x1E919], | ||
[0x1E93C, 0x1E91A], | ||
[0x1E93D, 0x1E91B], | ||
[0x1E93E, 0x1E91C], | ||
[0x1E93F, 0x1E91D], | ||
[0x1E940, 0x1E91E], | ||
[0x1E941, 0x1E91F], | ||
[0x1E942, 0x1E920], | ||
[0x1E943, 0x1E921] | ||
]); |
{ | ||
"name": "regexpu-core", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"description": "regexpu’s core functionality (i.e. `rewritePattern(pattern, flag)`), capable of translating ES6 Unicode regular expressions to ES5.", | ||
@@ -52,10 +52,11 @@ "homepage": "https://mths.be/regexpu", | ||
"regenerate": "^1.3.1", | ||
"regenerate-unicode-properties": "^1.0.0", | ||
"regenerate-unicode-properties": "^2.0.0", | ||
"regjsgen": "^0.3.0", | ||
"regjsparser": "^0.2.0", | ||
"unicode-loose-match": "^2.0.7" | ||
"unicode-match-property": "^0.1.1", | ||
"unicode-match-property-value": "^1.0.1" | ||
}, | ||
"devDependencies": { | ||
"codecov": "^1.0.1", | ||
"istanbul": "^0.4.0", | ||
"istanbul": "^0.4.4", | ||
"jsesc": "^2.1.0", | ||
@@ -65,4 +66,4 @@ "lodash": "^4.13.1", | ||
"regexpu-fixtures": "^2.0.1", | ||
"unicode-8.0.0": "^0.6.0" | ||
"unicode-9.0.0": "^0.7.0" | ||
} | ||
} |
@@ -6,6 +6,4 @@ 'use strict'; | ||
const regenerate = require('regenerate'); | ||
const looseMatch = require('unicode-loose-match'); | ||
const knownUnicodeProperties = new Set( | ||
require('regenerate-unicode-properties') | ||
); | ||
const unicodeMatchProperty = require('unicode-match-property'); | ||
const unicodeMatchPropertyValue = require('unicode-match-property-value'); | ||
const iuMappings = require('./data/iu-mappings.js'); | ||
@@ -25,3 +23,3 @@ const ESCAPE_SETS = require('./data/character-class-escape-sets.js'); | ||
const getUnicodePropertyValueSet = function(property, value) { | ||
const path = knownUnicodeProperties.has(property) ? | ||
const path = value ? | ||
`${ property }/${ value }` : | ||
@@ -39,26 +37,32 @@ `Binary_Property/${ property }`; | ||
const handleLoneUnicodePropertyNameOrValue = function(value) { | ||
// It could be a `General_Category` value or a binary property. | ||
// Note: `unicodeMatchPropertyValue` throws on invalid values. | ||
try { | ||
const property = 'General_Category'; | ||
const category = unicodeMatchPropertyValue(property, value); | ||
return getUnicodePropertyValueSet(property, category); | ||
} catch (exception) {} | ||
// It’s not a `General_Category` value, so check if it’s a binary | ||
// property. Note: `unicodeMatchProperty` throws on invalid properties. | ||
const property = unicodeMatchProperty(value); | ||
return getUnicodePropertyValueSet(property); | ||
}; | ||
const getUnicodePropertyEscapeSet = function(value, isNegative) { | ||
const parts = value.split('='); | ||
let canonical; | ||
const firstPart = parts[0]; | ||
let set; | ||
if (parts.length == 1) { | ||
const firstPart = parts[0]; | ||
// It could be a `General_Category` value or a binary property. | ||
canonical = looseMatch('General_Category', firstPart); | ||
if (!canonical.value) { | ||
// It’s not a `General_Category` value, so check if it’s a binary | ||
// property. Note: `looseMatch` throws on invalid properties. | ||
canonical = looseMatch(firstPart); | ||
} | ||
set = handleLoneUnicodePropertyNameOrValue(firstPart); | ||
} else { | ||
// The pattern consists of two parts, i.e. `Property=Value`. | ||
canonical = looseMatch(parts[0], parts[1]); | ||
const property = unicodeMatchProperty(firstPart); | ||
const value = unicodeMatchPropertyValue(property, parts[1]); | ||
set = getUnicodePropertyValueSet(property, value); | ||
} | ||
const set = getUnicodePropertyValueSet( | ||
canonical.property, | ||
canonical.value | ||
).clone(); | ||
if (isNegative) { | ||
return UNICODE_SET.clone().remove(set); | ||
} | ||
return set; | ||
return set.clone(); | ||
}; | ||
@@ -65,0 +69,0 @@ |
27014
1073
6
+ Addedregenerate-unicode-properties@2.0.0(transitive)
+ Addedunicode-canonical-property-names@1.0.3(transitive)
+ Addedunicode-match-property@0.1.3(transitive)
+ Addedunicode-match-property-value@1.0.2(transitive)
+ Addedunicode-property-aliases@1.6.1(transitive)
+ Addedunicode-property-value-aliases@1.2.2(transitive)
- Removedunicode-loose-match@^2.0.7
- Removedregenerate-unicode-properties@1.0.0(transitive)
- Removedunicode-loose-match@2.6.0(transitive)