Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@

test:
@./node_modules/.bin/mocha \
--require should \
--reporter spec \
--bail
@npm test

.PHONY: test
.PHONY: test
19 changes: 13 additions & 6 deletions lib/parse.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

/**
* Module dependencies.
*/

var escape = require('escape-regexp');
var assert = require('assert');

/**
Expand Down Expand Up @@ -167,6 +162,18 @@ function pattern(str) {
return new RegExp('^' + str + '$');
}

/**
* Escape regexp syntax in `str`.
*/

function escape(str) {
// Escape characters with special meaning either inside or outside character sets.
// 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.
return str
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
.replace(/-/g, '\\x2d');
}

/**
* Check if `str` is quoted.
*/
Expand Down Expand Up @@ -196,7 +203,7 @@ function numeric(str) {
*/

function comparison(str) {
switch (str) {
switch (str) {
case '>':
return 'gt';
case '<':
Expand Down
Loading