concat-regexp
Advanced tools
Comparing version 0.0.5 to 0.0.6
20
index.js
@@ -8,6 +8,6 @@ var slice = Array.prototype.slice | ||
var regexp = '' | ||
var modifiers = '' | ||
var piece | ||
var isRegExp | ||
var modifiers | ||
var i = -1 | ||
@@ -29,14 +29,14 @@ var last = pieces.length - 1 | ||
// Strip modifiers | ||
regexp += piece.replace(modifier, '$1') | ||
regexp += isRegExp || !boundary.test(piece) ? | ||
piece.replace(modifier, '$1') : | ||
piece | ||
// Set modifiers | ||
if (i === last) { | ||
if (!isRegExp && boundary.test(pieces[i])) { | ||
continue | ||
} | ||
if (!isRegExp && boundary.test(pieces[i])) { | ||
continue | ||
} | ||
modifiers = (pieces[i].toString().match(modifier) || []) | ||
.slice(2) | ||
.join('') | ||
} | ||
modifiers += (pieces[i].toString().match(modifier) || []) | ||
.slice(2) | ||
.join('') | ||
} | ||
@@ -43,0 +43,0 @@ |
{ | ||
"name": "concat-regexp", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A function that takes a series of regular expressions and returns them in concatenated form.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,3 +24,4 @@ var run = require('tape') | ||
{ input: concat(escape('example.com')), output: /example\.com/ }, | ||
{ input: concat(escape('example.org')), output: /example\.org/ } | ||
{ input: concat(escape('example.org')), output: /example\.org/ }, | ||
{ input: concat(/a/i, 'g'), output: /a/ig } | ||
] | ||
@@ -27,0 +28,0 @@ |
3948
82