compose-regexp
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -9,3 +9,3 @@ var empty = new RegExp('') | ||
// TODO investigate -] in charSets for isSequential and forSequence | ||
var tokenMatcher = /(\\[^])|[-()|\[\]]|\[\-/g | ||
var tokenMatcher = /(\\[^])|\[\-|[-()|\[\]]/g | ||
@@ -12,0 +12,0 @@ function isSequential(source) { |
@@ -15,3 +15,3 @@ (function (global, factory) { | ||
// TODO investigate -] in charSets for isSequential and forSequence | ||
var tokenMatcher = /(\\[^])|[-()|\[\]]|\[\-/g | ||
var tokenMatcher = /(\\[^])|\[\-|[-()|\[\]]/g | ||
@@ -18,0 +18,0 @@ function isSequential(source) { |
@@ -1,1 +0,1 @@ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define("compose-regexp",["exports"],e):e(n.composeRegexp={})}(this,function(n){"use strict";function e(n){return n instanceof RegExp?n.source:(n+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function t(n){if(n.indexOf("|")===-1)return!0;var e,t=0,r=!1;for(w.lastIndex=0;e=w.exec(n);)if(null==e[1]&&(r||"("!==e[0]||t++,r||")"!==e[0]||t--,r||"["!==e[0]&&"[-"!==e[0]||(r=!0),r&&"]"===e&&(r=!1),0===t&&!r&&"|"===e[0]))return!1;return!0}function r(n){if("("!==n.charAt(0)||")"!==n.charAt(n.length-1))return!1;var e,t=0,r=!1;for(w.lastIndex=0;e=w.exec(n);)if(null==e[1]){if(r||"("!==e[0]||t++,!r&&")"===e[0]&&0===--t&&e.index!==n.length-1)return!1;r||"["!==e[0]&&"[-"!==e||(r=!0),r&&"]"===e[0]&&(r=!1)}else if(e.index===n.length-2)return!1;return!0}function u(n){return n=e(n),t(n)?n:"(?:"+n+")"}function l(n){return 1===n.length||/^\\[^]$|^\[(?:\\[^]|[^\]])*\]$/.test(n)||r(n)}function i(){return arguments.length?new RegExp([].map.call(arguments,e).join("|")):h}function f(){return 0===arguments.length?"":1===arguments.length?e(arguments[0]):[].map.call(arguments,u).join("")}function o(){return new RegExp(f.apply(null,arguments))}function p(n){if(1===arguments.length)return h;var e=R.apply(f,arguments);return new RegExp(l(e)?e+n:"(?:"+e+")"+n)}function c(n){if(!E.test(n))throw new Error("Invalid suffix '"+n+"'.");return 1===arguments.length?p.bind(null,n):p.apply(null,arguments)}function a(n){return new RegExp("\\"+n)}function g(){return arguments.length?new RegExp("(?="+f.apply(null,arguments)+")"):h}function x(){return arguments.length?new RegExp("(?!"+f.apply(null,arguments)+")"):h}function s(n){return new RegExp(R.apply(f,arguments),n)}function d(){return arguments.length?new RegExp("("+f.apply(null,arguments)+")"):new RegExp("()")}var h=new RegExp(""),w=/(\\[^])|[-()|\[\]]|\[\-/g,E=o(/^/,i("+","*","?",/\{\s*\d+(?:\s*,\s*)?\d*\s*\}/),/\??$/),R=p.call;n.either=i,n.sequence=o,n.suffix=c,n.ref=a,n.lookAhead=g,n.avoid=x,n.flags=s,n.capture=d}); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define("compose-regexp",["exports"],e):e(n.composeRegexp={})}(this,function(n){"use strict";function e(n){return n instanceof RegExp?n.source:(n+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function t(n){if(n.indexOf("|")===-1)return!0;var e,t=0,r=!1;for(w.lastIndex=0;e=w.exec(n);)if(null==e[1]&&(r||"("!==e[0]||t++,r||")"!==e[0]||t--,r||"["!==e[0]&&"[-"!==e[0]||(r=!0),r&&"]"===e&&(r=!1),0===t&&!r&&"|"===e[0]))return!1;return!0}function r(n){if("("!==n.charAt(0)||")"!==n.charAt(n.length-1))return!1;var e,t=0,r=!1;for(w.lastIndex=0;e=w.exec(n);)if(null==e[1]){if(r||"("!==e[0]||t++,!r&&")"===e[0]&&0===--t&&e.index!==n.length-1)return!1;r||"["!==e[0]&&"[-"!==e||(r=!0),r&&"]"===e[0]&&(r=!1)}else if(e.index===n.length-2)return!1;return!0}function u(n){return n=e(n),t(n)?n:"(?:"+n+")"}function l(n){return 1===n.length||/^\\[^]$|^\[(?:\\[^]|[^\]])*\]$/.test(n)||r(n)}function i(){return arguments.length?new RegExp([].map.call(arguments,e).join("|")):h}function f(){return 0===arguments.length?"":1===arguments.length?e(arguments[0]):[].map.call(arguments,u).join("")}function o(){return new RegExp(f.apply(null,arguments))}function p(n){if(1===arguments.length)return h;var e=R.apply(f,arguments);return new RegExp(l(e)?e+n:"(?:"+e+")"+n)}function c(n){if(!E.test(n))throw new Error("Invalid suffix '"+n+"'.");return 1===arguments.length?p.bind(null,n):p.apply(null,arguments)}function a(n){return new RegExp("\\"+n)}function g(){return arguments.length?new RegExp("(?="+f.apply(null,arguments)+")"):h}function x(){return arguments.length?new RegExp("(?!"+f.apply(null,arguments)+")"):h}function s(n){return new RegExp(R.apply(f,arguments),n)}function d(){return arguments.length?new RegExp("("+f.apply(null,arguments)+")"):new RegExp("()")}var h=new RegExp(""),w=/(\\[^])|\[\-|[-()|\[\]]/g,E=o(/^/,i("+","*","?",/\{\s*\d+(?:\s*,\s*)?\d*\s*\}/),/\??$/),R=p.call;n.either=i,n.sequence=o,n.suffix=c,n.ref=a,n.lookAhead=g,n.avoid=x,n.flags=s,n.capture=d}); |
{ | ||
"name": "compose-regexp", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "A set of functions to build and compose complex regular expressions", | ||
@@ -5,0 +5,0 @@ "main": "compose-regexp.js", |
@@ -69,5 +69,4 @@ var CR = require('../') | ||
// this is a bit of a hack to take advantage of `eq` as assert equals. | ||
req(sequence(flags('m', /o/).multiline), /true/) | ||
req(sequence(flags('i', /o/).multiline), /false/) | ||
eq(flags('m', /o/).multiline, true) | ||
eq(flags('i', /o/).multiline, false) | ||
@@ -74,0 +73,0 @@ ;[ |
Sorry, the diff of this file is not supported yet
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
25144
846
298