Comparing version 0.1.4 to 0.1.5
@@ -18,3 +18,3 @@ { | ||
"main": "patrun.js", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"scripts": { | ||
@@ -21,0 +21,0 @@ "test": "./node_modules/.bin/jasmine-node ./test", |
/* Copyright (c) 2013 Richard Rodger, MIT License, https://github.com/rjrodger/patrun */ | ||
(function(){"use strict";var n=this,e=n.patrun,r="undefined"!=typeof require,t=n._,u=n.gex;if("undefined"==typeof t){if(!r)throw new Error("patrun requires underscore, see http://underscorejs.org");t=require("underscore")}if("undefined"==typeof u){if(!r)throw new Error("patrun requires gex, see https://github.com/rjrodger/gex");u=require("gex")}var i=n.patrun=function(){var r={},i={};return r.noConflict=function(){return n.patrun=e,r},r.add=function(n,e){for(var u,o=t.keys(n).sort(),s=i,d=0;d<o.length;d++){var f=o[d],v=n[f];if(null!==v&&void 0!==v)if(u=s.v,u&&f==s.k)s=u[v]||(u[v]={});else if(s.k)if(f<s.k){var l=s.v,a=s.s;s.v={},s.s={k:s.k,v:l,s:a},s.k=f,s=s.v[v]={}}else u=s.v,s=s.s||(s.s={}),d--;else s.k=f,s.v={},s=s.v[v]={}}return void 0!==e&&s&&(s.d=e),r},r.findexact=function(n){return r.find(n,!0)},r.find=function(n,e){var r,u=i,o=null,s=[],d={};do{if(r=u.k,u.v){var f=u.v[n[r]];f?(d[r]=!0,u.s&&s.push(u.s),o=f.d||null,u=f):u=u.s}else u=null;null==u&&null===o&&0<s.length&&(u=s.pop())}while(u);return null===o&&0===t.keys(n).length&&void 0!==i.d&&(o=i.d),e&&t.keys(d).length!=t.keys(n).length&&(o=null),o},r.remove=function(n){var e,r=i,t=null,u=[];do if(e=r.k,r.v){var o=r.v[n[e]];o?(u.push({km:r,v:n[e]}),t=o.d,r=o):r=r.s}else r=null;while(r);if(void 0!==t){var s=u[u.length-1];s&&s.km&&s.km.v&&delete s.km.v[s.v].d}},r.findall=function(n){function e(r,i,o,s){if(r.v){var d,f,v,l=r.k,a=u(n?n[l]:"*");for(var p in r.v)f=t.extend({},i),v=t.extend({},o),a.on(p)&&(f[l]=p,delete v[l],d=r.v[p],0===t.keys(v).length&&d&&d.d?s.push({match:f,data:d.d}):d&&d.v&&e(d,t.extend({},f),t.extend({},v),s));d=r.s,d&&e(d,t.extend({},f),t.extend({},v),s)}}var r=[];return e(i,{},t.extend({},n),r),r},r.toString=function(n,e){function r(n,e){for(var r=0;e>r;r++)n.push(" ")}function u(e,i,s,d){var f;if(void 0!==e.d&&(r(i,s),i.push(n(e.d)),o.push(d.join(", ")+" -> "+n(e.d))),e.k&&(i.push("\n"),r(i,s),i.push(e.k+":")),e.v){s++;for(var v in e.v)i.push("\n"),r(i,s),i.push(v+" ->"),f=t.clone(d),f.push(e.k+"="+v),u(e.v[v],i,s+1,f);e.s&&(i.push("\n"),r(i,s),i.push("* ->"),f=t.clone(d),u(e.s,i,s+1,f))}}n=t.isFunction(n)?n:function(n){return t.isFunction(n)?"<"+n.name+">":"<"+n+">"},e=t.isBoolean(arguments[0])?arguments[0]:e,e=void 0===e?!1:e;var o=[],s=[];return u(i,s,0,[]),e?s.join(""):o.join("\n")},r.inspect=r.toString,r.toJSON=function(n){return JSON.stringify(i,function(n,e){return t.isFunction(e)?"[Function]":e},n)},r};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=i),exports.patrun=i):n.patrun=i}).call(this); | ||
(function(){"use strict";var n=this,e=n.patrun,r="undefined"!=typeof require,t=n._,u=n.gex;if("undefined"==typeof t){if(!r)throw new Error("patrun requires underscore, see http://underscorejs.org");t=require("underscore")}if("undefined"==typeof u){if(!r)throw new Error("patrun requires gex, see https://github.com/rjrodger/gex");u=require("gex")}var i=n.patrun=function(){var r={},i={};return r.noConflict=function(){return n.patrun=e,r},r.add=function(n,e){for(var u,o=t.keys(n).sort(),s=i,d=0;d<o.length;d++){var f=o[d],v=n[f];if(null!==v&&void 0!==v)if(u=s.v,u&&f==s.k)s=u[v]||(u[v]={});else if(s.k)if(f<s.k){var l=s.v,a=s.s;s.v={},s.s={k:s.k,v:l,s:a},s.k=f,s=s.v[v]={}}else u=s.v,s=s.s||(s.s={}),d--;else s.k=f,s.v={},s=s.v[v]={}}return void 0!==e&&s&&(s.d=e),r},r.findexact=function(n){return r.find(n,!0)},r.find=function(n,e){var r,u=i,o=null,s=[],d={};do{if(r=u.k,u.v){var f=u.v[n[r]];f?(d[r]=!0,u.s&&s.push(u.s),o=f.d||null,u=f):u=u.s}else u=null;null==u&&null===o&&0<s.length&&(u=s.pop())}while(u);return null===o&&0===t.keys(n).length&&void 0!==i.d&&(o=i.d),e&&t.keys(d).length!=t.keys(n).length&&(o=null),o},r.remove=function(n){var e,r=i,t=null,u=[];do if(e=r.k,r.v){var o=r.v[n[e]];o?(u.push({km:r,v:n[e]}),t=o.d,r=o):r=r.s}else r=null;while(r);if(void 0!==t){var s=u[u.length-1];s&&s.km&&s.km.v&&delete s.km.v[s.v].d}},r.findall=function(n){function e(r,i,o,s){if(r.v){var d,f,v,l=r.k,a=u(n?n[l]:"*");for(var p in r.v)if(f=t.extend({},i),v=t.extend({},o),a.on(p)){var c=t.clone(f);c[l]=p,delete v[l],d=r.v[p],0===t.keys(v).length&&d&&d.d?s.push({match:c,data:d.d}):d&&d.v&&e(d,t.extend({},c),t.extend({},v),s)}d=r.s,d&&e(d,t.extend({},f),t.extend({},v),s)}}var r=[];return e(i,{},t.extend({},n),r),r},r.toString=function(n,e){function r(n,e){for(var r=0;e>r;r++)n.push(" ")}function u(e,i,s,d){var f;if(void 0!==e.d&&(r(i,s),i.push(n(e.d)),o.push(d.join(", ")+" -> "+n(e.d))),e.k&&(i.push("\n"),r(i,s),i.push(e.k+":")),e.v){s++;for(var v in e.v)i.push("\n"),r(i,s),i.push(v+" ->"),f=t.clone(d),f.push(e.k+"="+v),u(e.v[v],i,s+1,f);e.s&&(i.push("\n"),r(i,s),i.push("* ->"),f=t.clone(d),u(e.s,i,s+1,f))}}n=t.isFunction(n)?n:function(n){return t.isFunction(n)?"<"+n.name+">":"<"+n+">"},e=t.isBoolean(arguments[0])?arguments[0]:e,e=void 0===e?!1:e;var o=[],s=[];return u(i,s,0,[]),e?s.join(""):o.join("\n")},r.inspect=r.toString,r.toJSON=function(n){return JSON.stringify(i,function(n,e){return t.isFunction(e)?"[Function]":e},n)},r};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=i),exports.patrun=i):n.patrun=i}).call(this); | ||
//# sourceMappingURL=patrun-min.map |
@@ -195,3 +195,4 @@ /* Copyright (c) 2013 Richard Rodger, MIT License, https://github.com/rjrodger/patrun */ | ||
if( gexval.on(val) ) { | ||
itermatch[key]=val | ||
var valitermatch = _.clone(itermatch) | ||
valitermatch[key]=val | ||
delete itermissing[key] | ||
@@ -202,6 +203,6 @@ | ||
if( 0 === _.keys(itermissing).length && nextkeymap && nextkeymap.d ) { | ||
acc.push({match:itermatch,data:nextkeymap.d}) | ||
acc.push({match:valitermatch,data:nextkeymap.d}) | ||
} | ||
else if( nextkeymap && nextkeymap.v ) { | ||
descend(nextkeymap, _.extend({},itermatch), _.extend({},itermissing), acc) | ||
descend(nextkeymap, _.extend({},valitermatch), _.extend({},itermissing), acc) | ||
} | ||
@@ -208,0 +209,0 @@ } |
@@ -35,3 +35,3 @@ # patrun | ||
Current Version: 0.1.4 | ||
Current Version: 0.1.5 | ||
@@ -38,0 +38,0 @@ Tested on: Node.js 0.10.22, Chrome 31, Firefox 25 |
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
23510
256