Comparing version 1.0.20 to 1.0.21
# Change Log | ||
All notable changes to this project will be documented in this file (keepachangelog.com). | ||
## 1.0.19 - 2016-07-13 | ||
### Added | ||
- Add `debug` logging. | ||
### Changed | ||
- Update `.zuul.yml` to test only firefox versions `44..46` instead of just latest. | ||
## 1.0.18 - 2016-05-02 | ||
@@ -5,0 +12,0 @@ ### Added |
18
index.js
'use strict' | ||
/** | ||
* imports. | ||
*/ | ||
var curry2 = require('curry2') | ||
var debug = require('debug')('selectn') | ||
var dotted = require('brackets2dots') | ||
var splits = require('dotsplit.js') | ||
var curry2 = require('curry2') | ||
var string = Object.prototype.toString | ||
/** | ||
* exports. | ||
*/ | ||
module.exports = curry2(selectn) | ||
@@ -33,4 +26,8 @@ | ||
*/ | ||
function selectn (path, object) { | ||
debug('arguments:', { | ||
path: path, | ||
object: object | ||
}) | ||
function selectn (path, object) { | ||
var idx = -1 | ||
@@ -46,3 +43,4 @@ var seg = string.call(path) === '[object Array]' ? path : splits(dotted(path)) | ||
debug('ref:', ref) | ||
return typeof ref === 'function' ? ref() : ref | ||
} |
{ | ||
"name": "selectn", | ||
"description": "Curried property accessor function that resolves deeply-nested object properties via dot/bracket-notation string path while mitigating TypeErrors via friendly and composable API.", | ||
"version": "1.0.20", | ||
"version": "1.0.21", | ||
"author": "Wil Moore III <wil.moore@wilmoore.com>", | ||
@@ -10,2 +10,3 @@ "bugs": "https://github.com/wilmoore/selectn.js/issues", | ||
"curry2": "^1.0.0", | ||
"debug": "^2.2.0", | ||
"dotsplit.js": "^1.0.3" | ||
@@ -24,3 +25,3 @@ }, | ||
"uglify-js": "^2.6.1", | ||
"zuul": "^3.9.0" | ||
"zuul": "^3.10.1" | ||
}, | ||
@@ -27,0 +28,0 @@ "homepage": "https://github.com/wilmoore/selectn.js", |
528
selectn.js
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.selectn=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
'use strict' | ||
/** | ||
* imports. | ||
*/ | ||
var curry2 = require('curry2') | ||
var debug = require('debug')('selectn') | ||
var dotted = require('brackets2dots') | ||
var splits = require('dotsplit.js') | ||
var curry2 = require('curry2') | ||
var string = Object.prototype.toString | ||
/** | ||
* exports. | ||
*/ | ||
module.exports = curry2(selectn) | ||
@@ -34,4 +27,8 @@ | ||
*/ | ||
function selectn (path, object) { | ||
debug('arguments:', { | ||
path: path, | ||
object: object | ||
}) | ||
function selectn (path, object) { | ||
var idx = -1 | ||
@@ -47,6 +44,7 @@ var seg = string.call(path) === '[object Array]' ? path : splits(dotted(path)) | ||
debug('ref:', ref) | ||
return typeof ref === 'function' ? ref() : ref | ||
} | ||
},{"brackets2dots":6,"curry2":7,"dotsplit.js":8}],2:[function(require,module,exports){ | ||
},{"brackets2dots":6,"curry2":7,"debug":8,"dotsplit.js":10}],2:[function(require,module,exports){ | ||
'use strict' | ||
@@ -135,3 +133,3 @@ | ||
},{"./lib/expressions":3,"curry2":7,"selectn":10}],3:[function(require,module,exports){ | ||
},{"./lib/expressions":3,"curry2":7,"selectn":13}],3:[function(require,module,exports){ | ||
'use strict' | ||
@@ -238,3 +236,3 @@ | ||
},{"selectn":10}],4:[function(require,module,exports){ | ||
},{"selectn":13}],4:[function(require,module,exports){ | ||
'use strict' | ||
@@ -281,3 +279,3 @@ | ||
},{"curry2":5,"selectn":10}],5:[function(require,module,exports){ | ||
},{"curry2":5,"selectn":13}],5:[function(require,module,exports){ | ||
'use strict' | ||
@@ -405,3 +403,372 @@ | ||
},{"fast-bind":9}],8:[function(require,module,exports){ | ||
},{"fast-bind":11}],8:[function(require,module,exports){ | ||
/** | ||
* This is the web browser implementation of `debug()`. | ||
* | ||
* Expose `debug()` as the module. | ||
*/ | ||
exports = module.exports = require('./debug'); | ||
exports.log = log; | ||
exports.formatArgs = formatArgs; | ||
exports.save = save; | ||
exports.load = load; | ||
exports.useColors = useColors; | ||
exports.storage = 'undefined' != typeof chrome | ||
&& 'undefined' != typeof chrome.storage | ||
? chrome.storage.local | ||
: localstorage(); | ||
/** | ||
* Colors. | ||
*/ | ||
exports.colors = [ | ||
'lightseagreen', | ||
'forestgreen', | ||
'goldenrod', | ||
'dodgerblue', | ||
'darkorchid', | ||
'crimson' | ||
]; | ||
/** | ||
* Currently only WebKit-based Web Inspectors, Firefox >= v31, | ||
* and the Firebug extension (any Firefox version) are known | ||
* to support "%c" CSS customizations. | ||
* | ||
* TODO: add a `localStorage` variable to explicitly enable/disable colors | ||
*/ | ||
function useColors() { | ||
// is webkit? http://stackoverflow.com/a/16459606/376773 | ||
return ('WebkitAppearance' in document.documentElement.style) || | ||
// is firebug? http://stackoverflow.com/a/398120/376773 | ||
(window.console && (console.firebug || (console.exception && console.table))) || | ||
// is firefox >= v31? | ||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages | ||
(navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); | ||
} | ||
/** | ||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. | ||
*/ | ||
exports.formatters.j = function(v) { | ||
return JSON.stringify(v); | ||
}; | ||
/** | ||
* Colorize log arguments if enabled. | ||
* | ||
* @api public | ||
*/ | ||
function formatArgs() { | ||
var args = arguments; | ||
var useColors = this.useColors; | ||
args[0] = (useColors ? '%c' : '') | ||
+ this.namespace | ||
+ (useColors ? ' %c' : ' ') | ||
+ args[0] | ||
+ (useColors ? '%c ' : ' ') | ||
+ '+' + exports.humanize(this.diff); | ||
if (!useColors) return args; | ||
var c = 'color: ' + this.color; | ||
args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); | ||
// the final "%c" is somewhat tricky, because there could be other | ||
// arguments passed either before or after the %c, so we need to | ||
// figure out the correct index to insert the CSS into | ||
var index = 0; | ||
var lastC = 0; | ||
args[0].replace(/%[a-z%]/g, function(match) { | ||
if ('%%' === match) return; | ||
index++; | ||
if ('%c' === match) { | ||
// we only are interested in the *last* %c | ||
// (the user may have provided their own) | ||
lastC = index; | ||
} | ||
}); | ||
args.splice(lastC, 0, c); | ||
return args; | ||
} | ||
/** | ||
* Invokes `console.log()` when available. | ||
* No-op when `console.log` is not a "function". | ||
* | ||
* @api public | ||
*/ | ||
function log() { | ||
// this hackery is required for IE8/9, where | ||
// the `console.log` function doesn't have 'apply' | ||
return 'object' === typeof console | ||
&& console.log | ||
&& Function.prototype.apply.call(console.log, console, arguments); | ||
} | ||
/** | ||
* Save `namespaces`. | ||
* | ||
* @param {String} namespaces | ||
* @api private | ||
*/ | ||
function save(namespaces) { | ||
try { | ||
if (null == namespaces) { | ||
exports.storage.removeItem('debug'); | ||
} else { | ||
exports.storage.debug = namespaces; | ||
} | ||
} catch(e) {} | ||
} | ||
/** | ||
* Load `namespaces`. | ||
* | ||
* @return {String} returns the previously persisted debug modes | ||
* @api private | ||
*/ | ||
function load() { | ||
var r; | ||
try { | ||
r = exports.storage.debug; | ||
} catch(e) {} | ||
return r; | ||
} | ||
/** | ||
* Enable namespaces listed in `localStorage.debug` initially. | ||
*/ | ||
exports.enable(load()); | ||
/** | ||
* Localstorage attempts to return the localstorage. | ||
* | ||
* This is necessary because safari throws | ||
* when a user disables cookies/localstorage | ||
* and you attempt to access it. | ||
* | ||
* @return {LocalStorage} | ||
* @api private | ||
*/ | ||
function localstorage(){ | ||
try { | ||
return window.localStorage; | ||
} catch (e) {} | ||
} | ||
},{"./debug":9}],9:[function(require,module,exports){ | ||
/** | ||
* This is the common logic for both the Node.js and web browser | ||
* implementations of `debug()`. | ||
* | ||
* Expose `debug()` as the module. | ||
*/ | ||
exports = module.exports = debug; | ||
exports.coerce = coerce; | ||
exports.disable = disable; | ||
exports.enable = enable; | ||
exports.enabled = enabled; | ||
exports.humanize = require('ms'); | ||
/** | ||
* The currently active debug mode names, and names to skip. | ||
*/ | ||
exports.names = []; | ||
exports.skips = []; | ||
/** | ||
* Map of special "%n" handling functions, for the debug "format" argument. | ||
* | ||
* Valid key names are a single, lowercased letter, i.e. "n". | ||
*/ | ||
exports.formatters = {}; | ||
/** | ||
* Previously assigned color. | ||
*/ | ||
var prevColor = 0; | ||
/** | ||
* Previous log timestamp. | ||
*/ | ||
var prevTime; | ||
/** | ||
* Select a color. | ||
* | ||
* @return {Number} | ||
* @api private | ||
*/ | ||
function selectColor() { | ||
return exports.colors[prevColor++ % exports.colors.length]; | ||
} | ||
/** | ||
* Create a debugger with the given `namespace`. | ||
* | ||
* @param {String} namespace | ||
* @return {Function} | ||
* @api public | ||
*/ | ||
function debug(namespace) { | ||
// define the `disabled` version | ||
function disabled() { | ||
} | ||
disabled.enabled = false; | ||
// define the `enabled` version | ||
function enabled() { | ||
var self = enabled; | ||
// set `diff` timestamp | ||
var curr = +new Date(); | ||
var ms = curr - (prevTime || curr); | ||
self.diff = ms; | ||
self.prev = prevTime; | ||
self.curr = curr; | ||
prevTime = curr; | ||
// add the `color` if not set | ||
if (null == self.useColors) self.useColors = exports.useColors(); | ||
if (null == self.color && self.useColors) self.color = selectColor(); | ||
var args = Array.prototype.slice.call(arguments); | ||
args[0] = exports.coerce(args[0]); | ||
if ('string' !== typeof args[0]) { | ||
// anything else let's inspect with %o | ||
args = ['%o'].concat(args); | ||
} | ||
// apply any `formatters` transformations | ||
var index = 0; | ||
args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { | ||
// if we encounter an escaped % then don't increase the array index | ||
if (match === '%%') return match; | ||
index++; | ||
var formatter = exports.formatters[format]; | ||
if ('function' === typeof formatter) { | ||
var val = args[index]; | ||
match = formatter.call(self, val); | ||
// now we need to remove `args[index]` since it's inlined in the `format` | ||
args.splice(index, 1); | ||
index--; | ||
} | ||
return match; | ||
}); | ||
if ('function' === typeof exports.formatArgs) { | ||
args = exports.formatArgs.apply(self, args); | ||
} | ||
var logFn = enabled.log || exports.log || console.log.bind(console); | ||
logFn.apply(self, args); | ||
} | ||
enabled.enabled = true; | ||
var fn = exports.enabled(namespace) ? enabled : disabled; | ||
fn.namespace = namespace; | ||
return fn; | ||
} | ||
/** | ||
* Enables a debug mode by namespaces. This can include modes | ||
* separated by a colon and wildcards. | ||
* | ||
* @param {String} namespaces | ||
* @api public | ||
*/ | ||
function enable(namespaces) { | ||
exports.save(namespaces); | ||
var split = (namespaces || '').split(/[\s,]+/); | ||
var len = split.length; | ||
for (var i = 0; i < len; i++) { | ||
if (!split[i]) continue; // ignore empty strings | ||
namespaces = split[i].replace(/\*/g, '.*?'); | ||
if (namespaces[0] === '-') { | ||
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); | ||
} else { | ||
exports.names.push(new RegExp('^' + namespaces + '$')); | ||
} | ||
} | ||
} | ||
/** | ||
* Disable debug output. | ||
* | ||
* @api public | ||
*/ | ||
function disable() { | ||
exports.enable(''); | ||
} | ||
/** | ||
* Returns true if the given mode name is enabled, false otherwise. | ||
* | ||
* @param {String} name | ||
* @return {Boolean} | ||
* @api public | ||
*/ | ||
function enabled(name) { | ||
var i, len; | ||
for (i = 0, len = exports.skips.length; i < len; i++) { | ||
if (exports.skips[i].test(name)) { | ||
return false; | ||
} | ||
} | ||
for (i = 0, len = exports.names.length; i < len; i++) { | ||
if (exports.names[i].test(name)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
/** | ||
* Coerce `val`. | ||
* | ||
* @param {Mixed} val | ||
* @return {Mixed} | ||
* @api private | ||
*/ | ||
function coerce(val) { | ||
if (val instanceof Error) return val.stack || val.message; | ||
return val; | ||
} | ||
},{"ms":12}],10:[function(require,module,exports){ | ||
'use strict' | ||
@@ -474,3 +841,3 @@ | ||
},{"array.filter":2,"arraymap":4}],9:[function(require,module,exports){ | ||
},{"array.filter":2,"arraymap":4}],11:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -521,3 +888,130 @@ module.exports = function(boundThis) { | ||
},{}],10:[function(require,module,exports){ | ||
},{}],12:[function(require,module,exports){ | ||
/** | ||
* Helpers. | ||
*/ | ||
var s = 1000; | ||
var m = s * 60; | ||
var h = m * 60; | ||
var d = h * 24; | ||
var y = d * 365.25; | ||
/** | ||
* Parse or format the given `val`. | ||
* | ||
* Options: | ||
* | ||
* - `long` verbose formatting [false] | ||
* | ||
* @param {String|Number} val | ||
* @param {Object} options | ||
* @return {String|Number} | ||
* @api public | ||
*/ | ||
module.exports = function(val, options){ | ||
options = options || {}; | ||
if ('string' == typeof val) return parse(val); | ||
return options.long | ||
? long(val) | ||
: short(val); | ||
}; | ||
/** | ||
* Parse the given `str` and return milliseconds. | ||
* | ||
* @param {String} str | ||
* @return {Number} | ||
* @api private | ||
*/ | ||
function parse(str) { | ||
str = '' + str; | ||
if (str.length > 10000) return; | ||
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); | ||
if (!match) return; | ||
var n = parseFloat(match[1]); | ||
var type = (match[2] || 'ms').toLowerCase(); | ||
switch (type) { | ||
case 'years': | ||
case 'year': | ||
case 'yrs': | ||
case 'yr': | ||
case 'y': | ||
return n * y; | ||
case 'days': | ||
case 'day': | ||
case 'd': | ||
return n * d; | ||
case 'hours': | ||
case 'hour': | ||
case 'hrs': | ||
case 'hr': | ||
case 'h': | ||
return n * h; | ||
case 'minutes': | ||
case 'minute': | ||
case 'mins': | ||
case 'min': | ||
case 'm': | ||
return n * m; | ||
case 'seconds': | ||
case 'second': | ||
case 'secs': | ||
case 'sec': | ||
case 's': | ||
return n * s; | ||
case 'milliseconds': | ||
case 'millisecond': | ||
case 'msecs': | ||
case 'msec': | ||
case 'ms': | ||
return n; | ||
} | ||
} | ||
/** | ||
* Short format for `ms`. | ||
* | ||
* @param {Number} ms | ||
* @return {String} | ||
* @api private | ||
*/ | ||
function short(ms) { | ||
if (ms >= d) return Math.round(ms / d) + 'd'; | ||
if (ms >= h) return Math.round(ms / h) + 'h'; | ||
if (ms >= m) return Math.round(ms / m) + 'm'; | ||
if (ms >= s) return Math.round(ms / s) + 's'; | ||
return ms + 'ms'; | ||
} | ||
/** | ||
* Long format for `ms`. | ||
* | ||
* @param {Number} ms | ||
* @return {String} | ||
* @api private | ||
*/ | ||
function long(ms) { | ||
return plural(ms, d, 'day') | ||
|| plural(ms, h, 'hour') | ||
|| plural(ms, m, 'minute') | ||
|| plural(ms, s, 'second') | ||
|| ms + ' ms'; | ||
} | ||
/** | ||
* Pluralization helper. | ||
*/ | ||
function plural(ms, n, name) { | ||
if (ms < n) return; | ||
if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; | ||
return Math.ceil(ms / n) + ' ' + name + 's'; | ||
} | ||
},{}],13:[function(require,module,exports){ | ||
/*! | ||
@@ -524,0 +1018,0 @@ * exports. |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.selectn=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var dotted=require("brackets2dots");var splits=require("dotsplit.js");var curry2=require("curry2");var string=Object.prototype.toString;module.exports=curry2(selectn);function selectn(path,object){var idx=-1;var seg=string.call(path)==="[object Array]"?path:splits(dotted(path));var end=seg.length;var ref=end?object:void 0;while(++idx<end){if(Object(ref)!==ref)return void 0;ref=ref[seg[idx]]}return typeof ref==="function"?ref():ref}},{brackets2dots:6,curry2:7,"dotsplit.js":8}],2:[function(require,module,exports){"use strict";var curry2=require("curry2");var selectn=require("selectn");var expressions=require("./lib/expressions");module.exports=curry2(filter);function filter(predicate,list){var end=list.length;var idx=-1;var out=[];while(++idx<end){if(matchall(expressions(predicate,list[idx])))out.push(list[idx])}return out}function matchall(expressions){var end=expressions.length;var idx=-1;var out=false;while(++idx<end){var expression=expressions[idx];if({}.toString.call(expression.predicate)==="[object Function]"){out=!!expression.predicate(expression.element)}else if({}.toString.call(expression.predicate)==="[object RegExp]"){out=!!expression.predicate.exec(expression.element)}else if(expression.compare){out=expression.predicate===expression.element}else{out=selectn(expression.predicate,expression.element)}if(out===false){return out}}return out}},{"./lib/expressions":3,curry2:7,selectn:10}],3:[function(require,module,exports){"use strict";var selectn=require("selectn");module.exports=expressions;function expressions(predicate,element){var expressions=[];if(isFunction(predicate)||isRegExp(predicate)||isString(predicate)){expressions.push({predicate:predicate,element:element})}else{for(var key in predicate){expressions.push({predicate:predicate[key],element:selectn(key,element),compare:true})}}return expressions}function isRegExp(predicate){return{}.toString.call(predicate)==="[object RegExp]"}function isFunction(predicate){return{}.toString.call(predicate)==="[object Function]"}function isString(predicate){return{}.toString.call(predicate)==="[object String]"}},{selectn:10}],4:[function(require,module,exports){"use strict";var curry2=require("curry2");var selectn=require("selectn");module.exports=curry2(map);function map(fn,list){var end=list.length;var idx=-1;var out=[];while(++idx<end){out.push(typeof fn==="string"?selectn(fn,list[idx]):fn(list[idx]))}return out}},{curry2:5,selectn:10}],5:[function(require,module,exports){"use strict";module.exports=curry2;function curry2(fn,self){var out=function(){return arguments.length>1?fn.call(self,arguments[0],arguments[1]):fn.bind(self,arguments[0])};out.uncurry=function uncurry(){return fn};return out}},{}],6:[function(require,module,exports){"use strict";module.exports=brackets2dots;var REPLACE_BRACKETS=/\[([^\[\]]+)\]/g;var LFT_RT_TRIM_DOTS=/^[.]*|[.]*$/g;function brackets2dots(string){return{}.toString.call(string)=="[object String]"?string.replace(REPLACE_BRACKETS,".$1").replace(LFT_RT_TRIM_DOTS,""):""}},{}],7:[function(require,module,exports){"use strict";if(!Function.prototype.bind)Function.bind=require("fast-bind");module.exports=curry2;function curry2(fn,self){var out=function(){if(arguments.length===0)return out;return arguments.length>1?fn.apply(self,arguments):fn.bind(self,arguments[0])};out.uncurry=function uncurry(){return fn};return out}},{"fast-bind":9}],8:[function(require,module,exports){"use strict";var dotted=require("arraymap")(todots);var compact=require("array.filter")(String);var toString=Object.prototype.toString;module.exports=dotsplit;function dotsplit(string){return dotted(normalize(string))}function normalize(string){return compact((toString.call(string)==="[object String]"?string:"").replace(/\\\./g,"").split("."))}function todots(string){return string.replace(/\uffff/g,".")}},{"array.filter":2,arraymap:4}],9:[function(require,module,exports){"use strict";module.exports=function(boundThis){var f=this,ret;if(arguments.length<2)ret=function(){if(this instanceof ret){var ret_=f.apply(this,arguments);return Object(ret_)===ret_?ret_:this}else return f.apply(boundThis,arguments)};else{var boundArgs=new Array(arguments.length-1);for(var i=1;i<arguments.length;i++)boundArgs[i-1]=arguments[i];ret=function(){var boundLen=boundArgs.length,args=new Array(boundLen+arguments.length),i;for(i=0;i<boundLen;i++)args[i]=boundArgs[i];for(i=0;i<arguments.length;i++)args[boundLen+i]=arguments[i];if(this instanceof ret){var ret_=f.apply(this,args);return Object(ret_)===ret_?ret_:this}else return f.apply(boundThis,args)}}ret.prototype=f.prototype;return ret}},{}],10:[function(require,module,exports){module.exports=selectn;function selectn(query){var parts;if(Array.isArray(query)){parts=query}else{query=query.replace(/\[(\d+)\]/g,".$1");parts=query.split(".")}function accessor(object){var ref=object!=null?object:(1,eval)("this");var len=parts.length;var idx=0;for(;idx<len;idx+=1){if(ref!=null)ref=ref[parts[idx]]}return ref}return arguments.length>1?accessor(arguments[1]):accessor}},{}]},{},[1])(1)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.selectn=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var curry2=require("curry2");var debug=require("debug")("selectn");var dotted=require("brackets2dots");var splits=require("dotsplit.js");var string=Object.prototype.toString;module.exports=curry2(selectn);function selectn(path,object){debug("arguments:",{path:path,object:object});var idx=-1;var seg=string.call(path)==="[object Array]"?path:splits(dotted(path));var end=seg.length;var ref=end?object:void 0;while(++idx<end){if(Object(ref)!==ref)return void 0;ref=ref[seg[idx]]}debug("ref:",ref);return typeof ref==="function"?ref():ref}},{brackets2dots:6,curry2:7,debug:8,"dotsplit.js":10}],2:[function(require,module,exports){"use strict";var curry2=require("curry2");var selectn=require("selectn");var expressions=require("./lib/expressions");module.exports=curry2(filter);function filter(predicate,list){var end=list.length;var idx=-1;var out=[];while(++idx<end){if(matchall(expressions(predicate,list[idx])))out.push(list[idx])}return out}function matchall(expressions){var end=expressions.length;var idx=-1;var out=false;while(++idx<end){var expression=expressions[idx];if({}.toString.call(expression.predicate)==="[object Function]"){out=!!expression.predicate(expression.element)}else if({}.toString.call(expression.predicate)==="[object RegExp]"){out=!!expression.predicate.exec(expression.element)}else if(expression.compare){out=expression.predicate===expression.element}else{out=selectn(expression.predicate,expression.element)}if(out===false){return out}}return out}},{"./lib/expressions":3,curry2:7,selectn:13}],3:[function(require,module,exports){"use strict";var selectn=require("selectn");module.exports=expressions;function expressions(predicate,element){var expressions=[];if(isFunction(predicate)||isRegExp(predicate)||isString(predicate)){expressions.push({predicate:predicate,element:element})}else{for(var key in predicate){expressions.push({predicate:predicate[key],element:selectn(key,element),compare:true})}}return expressions}function isRegExp(predicate){return{}.toString.call(predicate)==="[object RegExp]"}function isFunction(predicate){return{}.toString.call(predicate)==="[object Function]"}function isString(predicate){return{}.toString.call(predicate)==="[object String]"}},{selectn:13}],4:[function(require,module,exports){"use strict";var curry2=require("curry2");var selectn=require("selectn");module.exports=curry2(map);function map(fn,list){var end=list.length;var idx=-1;var out=[];while(++idx<end){out.push(typeof fn==="string"?selectn(fn,list[idx]):fn(list[idx]))}return out}},{curry2:5,selectn:13}],5:[function(require,module,exports){"use strict";module.exports=curry2;function curry2(fn,self){var out=function(){return arguments.length>1?fn.call(self,arguments[0],arguments[1]):fn.bind(self,arguments[0])};out.uncurry=function uncurry(){return fn};return out}},{}],6:[function(require,module,exports){"use strict";module.exports=brackets2dots;var REPLACE_BRACKETS=/\[([^\[\]]+)\]/g;var LFT_RT_TRIM_DOTS=/^[.]*|[.]*$/g;function brackets2dots(string){return{}.toString.call(string)=="[object String]"?string.replace(REPLACE_BRACKETS,".$1").replace(LFT_RT_TRIM_DOTS,""):""}},{}],7:[function(require,module,exports){"use strict";if(!Function.prototype.bind)Function.bind=require("fast-bind");module.exports=curry2;function curry2(fn,self){var out=function(){if(arguments.length===0)return out;return arguments.length>1?fn.apply(self,arguments):fn.bind(self,arguments[0])};out.uncurry=function uncurry(){return fn};return out}},{"fast-bind":11}],8:[function(require,module,exports){exports=module.exports=require("./debug");exports.log=log;exports.formatArgs=formatArgs;exports.save=save;exports.load=load;exports.useColors=useColors;exports.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:localstorage();exports.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function useColors(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}exports.formatters.j=function(v){return JSON.stringify(v)};function formatArgs(){var args=arguments;var useColors=this.useColors;args[0]=(useColors?"%c":"")+this.namespace+(useColors?" %c":" ")+args[0]+(useColors?"%c ":" ")+"+"+exports.humanize(this.diff);if(!useColors)return args;var c="color: "+this.color;args=[args[0],c,"color: inherit"].concat(Array.prototype.slice.call(args,1));var index=0;var lastC=0;args[0].replace(/%[a-z%]/g,function(match){if("%%"===match)return;index++;if("%c"===match){lastC=index}});args.splice(lastC,0,c);return args}function log(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(namespaces){try{if(null==namespaces){exports.storage.removeItem("debug")}else{exports.storage.debug=namespaces}}catch(e){}}function load(){var r;try{r=exports.storage.debug}catch(e){}return r}exports.enable(load());function localstorage(){try{return window.localStorage}catch(e){}}},{"./debug":9}],9:[function(require,module,exports){exports=module.exports=debug;exports.coerce=coerce;exports.disable=disable;exports.enable=enable;exports.enabled=enabled;exports.humanize=require("ms");exports.names=[];exports.skips=[];exports.formatters={};var prevColor=0;var prevTime;function selectColor(){return exports.colors[prevColor++%exports.colors.length]}function debug(namespace){function disabled(){}disabled.enabled=false;function enabled(){var self=enabled;var curr=+new Date;var ms=curr-(prevTime||curr);self.diff=ms;self.prev=prevTime;self.curr=curr;prevTime=curr;if(null==self.useColors)self.useColors=exports.useColors();if(null==self.color&&self.useColors)self.color=selectColor();var args=Array.prototype.slice.call(arguments);args[0]=exports.coerce(args[0]);if("string"!==typeof args[0]){args=["%o"].concat(args)}var index=0;args[0]=args[0].replace(/%([a-z%])/g,function(match,format){if(match==="%%")return match;index++;var formatter=exports.formatters[format];if("function"===typeof formatter){var val=args[index];match=formatter.call(self,val);args.splice(index,1);index--}return match});if("function"===typeof exports.formatArgs){args=exports.formatArgs.apply(self,args)}var logFn=enabled.log||exports.log||console.log.bind(console);logFn.apply(self,args)}enabled.enabled=true;var fn=exports.enabled(namespace)?enabled:disabled;fn.namespace=namespace;return fn}function enable(namespaces){exports.save(namespaces);var split=(namespaces||"").split(/[\s,]+/);var len=split.length;for(var i=0;i<len;i++){if(!split[i])continue;namespaces=split[i].replace(/\*/g,".*?");if(namespaces[0]==="-"){exports.skips.push(new RegExp("^"+namespaces.substr(1)+"$"))}else{exports.names.push(new RegExp("^"+namespaces+"$"))}}}function disable(){exports.enable("")}function enabled(name){var i,len;for(i=0,len=exports.skips.length;i<len;i++){if(exports.skips[i].test(name)){return false}}for(i=0,len=exports.names.length;i<len;i++){if(exports.names[i].test(name)){return true}}return false}function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}},{ms:12}],10:[function(require,module,exports){"use strict";var dotted=require("arraymap")(todots);var compact=require("array.filter")(String);var toString=Object.prototype.toString;module.exports=dotsplit;function dotsplit(string){return dotted(normalize(string))}function normalize(string){return compact((toString.call(string)==="[object String]"?string:"").replace(/\\\./g,"").split("."))}function todots(string){return string.replace(/\uffff/g,".")}},{"array.filter":2,arraymap:4}],11:[function(require,module,exports){"use strict";module.exports=function(boundThis){var f=this,ret;if(arguments.length<2)ret=function(){if(this instanceof ret){var ret_=f.apply(this,arguments);return Object(ret_)===ret_?ret_:this}else return f.apply(boundThis,arguments)};else{var boundArgs=new Array(arguments.length-1);for(var i=1;i<arguments.length;i++)boundArgs[i-1]=arguments[i];ret=function(){var boundLen=boundArgs.length,args=new Array(boundLen+arguments.length),i;for(i=0;i<boundLen;i++)args[i]=boundArgs[i];for(i=0;i<arguments.length;i++)args[boundLen+i]=arguments[i];if(this instanceof ret){var ret_=f.apply(this,args);return Object(ret_)===ret_?ret_:this}else return f.apply(boundThis,args)}}ret.prototype=f.prototype;return ret}},{}],12:[function(require,module,exports){var s=1e3;var m=s*60;var h=m*60;var d=h*24;var y=d*365.25;module.exports=function(val,options){options=options||{};if("string"==typeof val)return parse(val);return options.long?long(val):short(val)};function parse(str){str=""+str;if(str.length>1e4)return;var match=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);if(!match)return;var n=parseFloat(match[1]);var type=(match[2]||"ms").toLowerCase();switch(type){case"years":case"year":case"yrs":case"yr":case"y":return n*y;case"days":case"day":case"d":return n*d;case"hours":case"hour":case"hrs":case"hr":case"h":return n*h;case"minutes":case"minute":case"mins":case"min":case"m":return n*m;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}function short(ms){if(ms>=d)return Math.round(ms/d)+"d";if(ms>=h)return Math.round(ms/h)+"h";if(ms>=m)return Math.round(ms/m)+"m";if(ms>=s)return Math.round(ms/s)+"s";return ms+"ms"}function long(ms){return plural(ms,d,"day")||plural(ms,h,"hour")||plural(ms,m,"minute")||plural(ms,s,"second")||ms+" ms"}function plural(ms,n,name){if(ms<n)return;if(ms<n*1.5)return Math.floor(ms/n)+" "+name;return Math.ceil(ms/n)+" "+name+"s"}},{}],13:[function(require,module,exports){module.exports=selectn;function selectn(query){var parts;if(Array.isArray(query)){parts=query}else{query=query.replace(/\[(\d+)\]/g,".$1");parts=query.split(".")}function accessor(object){var ref=object!=null?object:(1,eval)("this");var len=parts.length;var idx=0;for(;idx<len;idx+=1){if(ref!=null)ref=ref[parts[idx]]}return ref}return arguments.length>1?accessor(arguments[1]):accessor}},{}]},{},[1])(1)}); |
51853
1058
4
+ Addeddebug@^2.2.0
+ Addeddebug@2.6.9(transitive)
+ Addedms@2.0.0(transitive)