regexp-to-ast
Advanced tools
Comparing version 0.3.4 to 0.3.5
@@ -60,6 +60,8 @@ export as namespace regexpToAst | ||
export type Range = { from: number; to: number } | ||
export interface Set extends IRegExpAST { | ||
type: "Set" | ||
complement: boolean | ||
value: number[] | ||
value: (number | Range)[] | ||
quantifier?: Quantifier | ||
@@ -66,0 +68,0 @@ } |
@@ -0,1 +1,13 @@ | ||
## 0.3.5 (7-12-2018) | ||
* A Set AST can now contain ranges of char codes as well as single char codes. | ||
```typescript | ||
export interface Set extends IRegExpAST { | ||
type: "Set" | ||
complement: boolean | ||
value: (number | Range)[] | ||
quantifier?: Quantifier | ||
} | ||
``` | ||
## 0.3.4 (6-16-2018) | ||
@@ -2,0 +14,0 @@ |
@@ -438,10 +438,5 @@ ;(function(root, factory) { | ||
} | ||
for ( | ||
var charCode = from.value; | ||
charCode <= to.value; | ||
charCode++ | ||
) { | ||
set.push(charCode) | ||
} | ||
set.push({ from: from.value, to: to.value }) | ||
} else { | ||
// literal dash | ||
insertToSet(from.value, set) | ||
@@ -458,3 +453,3 @@ set.push(cc("-")) | ||
return { type: "Set", complement: complement, value: uniq(set) } | ||
return { type: "Set", complement: complement, value: set } | ||
} | ||
@@ -785,16 +780,2 @@ | ||
function uniq(arr) { | ||
var setMap = {} | ||
arr.forEach(function(item) { | ||
setMap[item] = item | ||
}) | ||
var set = [] | ||
for (var key in setMap) { | ||
set.push(setMap[key]) | ||
} | ||
return set | ||
} | ||
function insertToSet(item, set) { | ||
@@ -980,5 +961,5 @@ if (item.length !== undefined) { | ||
BaseRegExpVisitor: BaseRegExpVisitor, | ||
VERSION: "0.3.4" | ||
VERSION: "0.3.5" | ||
} | ||
} | ||
) |
{ | ||
"name": "regexp-to-ast", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"main": "lib/regexp-to-ast.js", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/bd82/regexp-to-ast.git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40451
954