Skip to content

Commit d37f2d1

Browse files
authored
Merge pull request #1 from imdone/0.2.2
0.2.2
2 parents fa7d121 + eb68ee9 commit d37f2d1

7 files changed

Lines changed: 292 additions & 970 deletions

File tree

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test

Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11

22
test:
3-
@./node_modules/.bin/mocha \
4-
--require should \
5-
--reporter spec \
6-
--bail
3+
@npm test
74

8-
.PHONY: test
5+
.PHONY: test

lib/parse.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11

2-
/**
3-
* Module dependencies.
4-
*/
5-
6-
var escape = require('escape-regexp');
72
var assert = require('assert');
83

94
/**
@@ -167,6 +162,18 @@ function pattern(str) {
167162
return new RegExp('^' + str + '$');
168163
}
169164

165+
/**
166+
* Escape regexp syntax in `str`.
167+
*/
168+
169+
function escape(str) {
170+
// Escape characters with special meaning either inside or outside character sets.
171+
// Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
172+
return str
173+
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
174+
.replace(/-/g, '\\x2d');
175+
}
176+
170177
/**
171178
* Check if `str` is quoted.
172179
*/
@@ -196,7 +203,7 @@ function numeric(str) {
196203
*/
197204

198205
function comparison(str) {
199-
switch (str) {
206+
switch (str) {
200207
case '>':
201208
return 'gt';
202209
case '<':

0 commit comments

Comments
 (0)