(function(){function b(a,b){return a===Error?b&&b.name.indexOf("Error")!==-1:a===undefined?!0:typeof a=="object"?JSON.stringify(a)===JSON.stringify(b):a.toString()===b.toString()}function c(){var a=[],c;return function(){c||(c=arguments.length-1);if(c===arguments.length){var d=0,e=0;a:for(;e<arguments.length;e++)for(;d<a.length;d++){var f=a[d];if(f.length>e)if(b(f[e],arguments[e])){if(arguments.length!==e+1)continue a}else{e=0;if(a.length!==d+1)continue}var g=f[f.length-1];return typeof g=="function"?g.apply(this,[].slice.call(arguments,0)):null}}else a.push([].slice.call(arguments,0))}}var a=typeof process!="undefined"&&process.env.DEBUG;typeof exports=="undefined"?window.pattern=c:module.exports=c})()
KGZ1bmN0aW9uKCl7ZnVuY3Rpb24gYihhLGIpe3JldHVybiBhPT09RXJyb3I/YiYmYi5uYW1lLmluZGV4T2YoIkVycm9yIikhPT0tMTphPT09dW5kZWZpbmVkPyEwOnR5cGVvZiBhPT0ib2JqZWN0Ij9KU09OLnN0cmluZ2lmeShhKT09PUpTT04uc3RyaW5naWZ5KGIpOmEudG9TdHJpbmcoKT09PWIudG9TdHJpbmcoKX1mdW5jdGlvbiBjKCl7dmFyIGE9W10sYztyZXR1cm4gZnVuY3Rpb24oKXtjfHwoYz1hcmd1bWVudHMubGVuZ3RoLTEpO2lmKGM9PT1hcmd1bWVudHMubGVuZ3RoKXt2YXIgZD0wLGU9MDthOmZvcig7ZTxhcmd1bWVudHMubGVuZ3RoO2UrKylmb3IoO2Q8YS5sZW5ndGg7ZCsrKXt2YXIgZj1hW2RdO2lmKGYubGVuZ3RoPmUpaWYoYihmW2VdLGFyZ3VtZW50c1tlXSkpe2lmKGFyZ3VtZW50cy5sZW5ndGghPT1lKzEpY29udGludWUgYX1lbHNle2U9MDtpZihhLmxlbmd0aCE9PWQrMSljb250aW51ZX12YXIgZz1mW2YubGVuZ3RoLTFdO3JldHVybiB0eXBlb2YgZz09ImZ1bmN0aW9uIj9nLmFwcGx5KHRoaXMsW10uc2xpY2UuY2FsbChhcmd1bWVudHMsMCkpOm51bGx9fWVsc2UgYS5wdXNoKFtdLnNsaWNlLmNhbGwoYXJndW1lbnRzLDApKX19dmFyIGE9dHlwZW9mIHByb2Nlc3MhPSJ1bmRlZmluZWQiJiZwcm9jZXNzLmVudi5ERUJVRzt0eXBlb2YgZXhwb3J0cz09InVuZGVmaW5lZCI/d2luZG93LnBhdHRlcm49Yzptb2R1bGUuZXhwb3J0cz1jfSkoKQ==
(function () { // stack refers to registered patterns
var DEBUG = typeof process !== 'undefined' && process.env.DEBUG;
function log() { if(DEBUG) console.log.apply(this,arguments); }
function match(pattern, value) {
if(pattern === Error) {
return value && value.name.indexOf('Error') !== -1;}
if(pattern === undefined) return true;
if(typeof pattern === 'object')
return JSON.stringify(pattern) === JSON.stringify(value);
return pattern.toString() === value.toString(); }
function p() { var stack = [], arity;
return function () {
if(!arity) { arity = arguments.length-1; } // set arity in first invok.
if(arity===arguments.length) { // # arguments match arity, execute
var j = 0, i=0; // we need explicit control over vars
ol: for(; i<arguments.length; i++) { // for each argument
il: for(; j<stack.length; j++) { // for pattern in the stack
var s = stack[j]; // get the current pattern
log('α ', i, j);
log(' ░ ', s, s[i]);
log(' σ ', s.length);
log(' • ', [].slice.call(arguments,0));
if(s.length > i) { // if there's something in this pos for pattern
if(match(s[i], arguments[i])) { // if we have a match
log(' ✔ ', s[i], '===', arguments[i]);
if(arguments.length !== i+1) { log(' ⥁'); continue ol; } }
else { // if it doesnt match try next pattern in stack
log(' ✗ ', s[i], '===', arguments[i]);
i=0;
// dont break and set ok to false if this is the last element
if(stack.length!==j+1) { log(' ⥁'); continue; } } }
var f = s[s.length-1];
log(' ' + (typeof f === 'function' ? 'ƒ' : 'λ'), f.name || f);
// execute whatever is the last argument on last pattern of stack
return (typeof f === 'function') ? // is there a callback?
f.apply(this, [].slice.call(arguments,0)) : null; } }
} else {
stack.push([].slice.call(arguments,0)); // initializing add pattern
log('‣ ', [].slice.call(arguments,0));
} }; } // dont cache, each require is a new inst.
typeof exports === 'undefined' ? (window.pattern=p) : (module.exports = p);
})();