You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1592 lines
49 KiB
JavaScript
1592 lines
49 KiB
JavaScript
/**
|
|
* Modules in this bundle
|
|
* @license
|
|
*
|
|
* stringifier:
|
|
* license: MIT (http://opensource.org/licenses/MIT)
|
|
* author: Takuto Wada <takuto.wada@gmail.com>
|
|
* homepage: https://github.com/twada/stringifier
|
|
* version: 1.4.0
|
|
*
|
|
* core-js:
|
|
* license: MIT (http://opensource.org/licenses/MIT)
|
|
* homepage: https://github.com/zloirock/core-js#readme
|
|
* version: 2.5.7
|
|
*
|
|
* traverse:
|
|
* license: MIT (http://opensource.org/licenses/MIT)
|
|
* author: James Halliday <mail@substack.net>
|
|
* homepage: https://github.com/substack/js-traverse
|
|
* version: 0.6.6
|
|
*
|
|
* type-name:
|
|
* license: MIT (http://opensource.org/licenses/MIT)
|
|
* author: Takuto Wada <takuto.wada@gmail.com>
|
|
* contributors: azu, Yosuke Furukawa, Athan, Andrew Moss
|
|
* homepage: https://github.com/twada/type-name
|
|
* version: 2.0.2
|
|
*
|
|
* This header is generated by licensify (https://github.com/twada/licensify)
|
|
*/
|
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.stringifier = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw (a.code="MODULE_NOT_FOUND", a)}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(_dereq_,module,exports){
|
|
/**
|
|
* stringifier
|
|
*
|
|
* https://github.com/twada/stringifier
|
|
*
|
|
* Copyright (c) 2014-2018 Takuto Wada
|
|
* Licensed under the MIT license.
|
|
* https://twada.mit-license.org/2014-2018
|
|
*/
|
|
'use strict';
|
|
|
|
var traverse = _dereq_('traverse');
|
|
var typeName = _dereq_('type-name');
|
|
var assign = _dereq_('core-js/library/fn/object/assign');
|
|
var endsWith = _dereq_('core-js/library/fn/string/ends-with');
|
|
var s = _dereq_('./strategies');
|
|
|
|
function defaultHandlers () {
|
|
return {
|
|
'null': s.always('null'),
|
|
'undefined': s.always('undefined'),
|
|
'function': s.prune(),
|
|
'string': s.json(),
|
|
'boolean': s.json(),
|
|
'number': s.number(),
|
|
'symbol': s.toStr(),
|
|
'RegExp': s.toStr(),
|
|
'String': s.newLike(),
|
|
'Boolean': s.newLike(),
|
|
'Number': s.newLike(),
|
|
'Date': s.newLike(),
|
|
'Array': s.array(),
|
|
'Object': s.object(),
|
|
'Error': s.object(null, ['message', 'code']),
|
|
'@default': s.object()
|
|
};
|
|
}
|
|
|
|
function defaultOptions () {
|
|
return {
|
|
maxDepth: null,
|
|
indent: null,
|
|
anonymous: '@Anonymous',
|
|
circular: '#@Circular#',
|
|
snip: '..(snip)',
|
|
lineSeparator: '\n',
|
|
typeFun: typeName
|
|
};
|
|
}
|
|
|
|
function createStringifier (customOptions) {
|
|
var options = assign({}, defaultOptions(), customOptions);
|
|
var handlers = assign({}, defaultHandlers(), options.handlers);
|
|
return function stringifyAny (push, x) {
|
|
var context = this;
|
|
var handler = handlerFor(context.node, options, handlers);
|
|
var currentPath = '/' + context.path.join('/');
|
|
var customization = handlers[currentPath];
|
|
var acc = {
|
|
context: context,
|
|
options: options,
|
|
handlers: handlers,
|
|
push: push
|
|
};
|
|
if (typeName(customization) === 'function') {
|
|
handler = customization;
|
|
} else if (typeName(customization) === 'number') {
|
|
handler = s.flow.compose(s.filters.truncate(customization),handler);
|
|
} else if (context.parent && typeName(context.parent.node) === 'Array' && !(context.key in context.parent.node)) {
|
|
// sparse arrays
|
|
handler = s.always('');
|
|
}
|
|
handler(acc, x);
|
|
return push;
|
|
};
|
|
}
|
|
|
|
function handlerFor (val, options, handlers) {
|
|
var tname = options.typeFun(val);
|
|
if (typeName(handlers[tname]) === 'function') {
|
|
return handlers[tname];
|
|
}
|
|
if (endsWith(tname, 'Error')) {
|
|
return handlers['Error'];
|
|
}
|
|
return handlers['@default'];
|
|
}
|
|
|
|
function walk (val, reducer) {
|
|
var buffer = [];
|
|
var push = function (str) {
|
|
buffer.push(str);
|
|
};
|
|
traverse(val).reduce(reducer, push);
|
|
return buffer.join('');
|
|
}
|
|
|
|
function stringify (val, options) {
|
|
return walk(val, createStringifier(options));
|
|
}
|
|
|
|
function stringifier (options) {
|
|
return function (val) {
|
|
return walk(val, createStringifier(options));
|
|
};
|
|
}
|
|
|
|
stringifier.stringify = stringify;
|
|
stringifier.strategies = s;
|
|
stringifier.defaultOptions = defaultOptions;
|
|
stringifier.defaultHandlers = defaultHandlers;
|
|
module.exports = stringifier;
|
|
|
|
},{"./strategies":61,"core-js/library/fn/object/assign":6,"core-js/library/fn/string/ends-with":7,"traverse":59,"type-name":60}],2:[function(_dereq_,module,exports){
|
|
_dereq_('../../modules/es6.array.filter');
|
|
module.exports = _dereq_('../../modules/_core').Array.filter;
|
|
|
|
},{"../../modules/_core":16,"../../modules/es6.array.filter":53}],3:[function(_dereq_,module,exports){
|
|
_dereq_('../../modules/es6.array.for-each');
|
|
module.exports = _dereq_('../../modules/_core').Array.forEach;
|
|
|
|
},{"../../modules/_core":16,"../../modules/es6.array.for-each":54}],4:[function(_dereq_,module,exports){
|
|
_dereq_('../../modules/es6.array.index-of');
|
|
module.exports = _dereq_('../../modules/_core').Array.indexOf;
|
|
|
|
},{"../../modules/_core":16,"../../modules/es6.array.index-of":55}],5:[function(_dereq_,module,exports){
|
|
_dereq_('../../modules/es6.array.reduce-right');
|
|
module.exports = _dereq_('../../modules/_core').Array.reduceRight;
|
|
|
|
},{"../../modules/_core":16,"../../modules/es6.array.reduce-right":56}],6:[function(_dereq_,module,exports){
|
|
_dereq_('../../modules/es6.object.assign');
|
|
module.exports = _dereq_('../../modules/_core').Object.assign;
|
|
|
|
},{"../../modules/_core":16,"../../modules/es6.object.assign":57}],7:[function(_dereq_,module,exports){
|
|
_dereq_('../../modules/es6.string.ends-with');
|
|
module.exports = _dereq_('../../modules/_core').String.endsWith;
|
|
|
|
},{"../../modules/_core":16,"../../modules/es6.string.ends-with":58}],8:[function(_dereq_,module,exports){
|
|
module.exports = function (it) {
|
|
if (typeof it != 'function') throw TypeError(it + ' is not a function!');
|
|
return it;
|
|
};
|
|
|
|
},{}],9:[function(_dereq_,module,exports){
|
|
var isObject = _dereq_('./_is-object');
|
|
module.exports = function (it) {
|
|
if (!isObject(it)) throw TypeError(it + ' is not an object!');
|
|
return it;
|
|
};
|
|
|
|
},{"./_is-object":31}],10:[function(_dereq_,module,exports){
|
|
// false -> Array#indexOf
|
|
// true -> Array#includes
|
|
var toIObject = _dereq_('./_to-iobject');
|
|
var toLength = _dereq_('./_to-length');
|
|
var toAbsoluteIndex = _dereq_('./_to-absolute-index');
|
|
module.exports = function (IS_INCLUDES) {
|
|
return function ($this, el, fromIndex) {
|
|
var O = toIObject($this);
|
|
var length = toLength(O.length);
|
|
var index = toAbsoluteIndex(fromIndex, length);
|
|
var value;
|
|
// Array#includes uses SameValueZero equality algorithm
|
|
// eslint-disable-next-line no-self-compare
|
|
if (IS_INCLUDES && el != el) while (length > index) {
|
|
value = O[index++];
|
|
// eslint-disable-next-line no-self-compare
|
|
if (value != value) return true;
|
|
// Array#indexOf ignores holes, Array#includes - not
|
|
} else for (;length > index; index++) if (IS_INCLUDES || index in O) {
|
|
if (O[index] === el) return IS_INCLUDES || index || 0;
|
|
} return !IS_INCLUDES && -1;
|
|
};
|
|
};
|
|
|
|
},{"./_to-absolute-index":45,"./_to-iobject":47,"./_to-length":48}],11:[function(_dereq_,module,exports){
|
|
// 0 -> Array#forEach
|
|
// 1 -> Array#map
|
|
// 2 -> Array#filter
|
|
// 3 -> Array#some
|
|
// 4 -> Array#every
|
|
// 5 -> Array#find
|
|
// 6 -> Array#findIndex
|
|
var ctx = _dereq_('./_ctx');
|
|
var IObject = _dereq_('./_iobject');
|
|
var toObject = _dereq_('./_to-object');
|
|
var toLength = _dereq_('./_to-length');
|
|
var asc = _dereq_('./_array-species-create');
|
|
module.exports = function (TYPE, $create) {
|
|
var IS_MAP = TYPE == 1;
|
|
var IS_FILTER = TYPE == 2;
|
|
var IS_SOME = TYPE == 3;
|
|
var IS_EVERY = TYPE == 4;
|
|
var IS_FIND_INDEX = TYPE == 6;
|
|
var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
|
var create = $create || asc;
|
|
return function ($this, callbackfn, that) {
|
|
var O = toObject($this);
|
|
var self = IObject(O);
|
|
var f = ctx(callbackfn, that, 3);
|
|
var length = toLength(self.length);
|
|
var index = 0;
|
|
var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
|
|
var val, res;
|
|
for (;length > index; index++) if (NO_HOLES || index in self) {
|
|
val = self[index];
|
|
res = f(val, index, O);
|
|
if (TYPE) {
|
|
if (IS_MAP) result[index] = res; // map
|
|
else if (res) switch (TYPE) {
|
|
case 3: return true; // some
|
|
case 5: return val; // find
|
|
case 6: return index; // findIndex
|
|
case 2: result.push(val); // filter
|
|
} else if (IS_EVERY) return false; // every
|
|
}
|
|
}
|
|
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
|
|
};
|
|
};
|
|
|
|
},{"./_array-species-create":14,"./_ctx":17,"./_iobject":29,"./_to-length":48,"./_to-object":49}],12:[function(_dereq_,module,exports){
|
|
var aFunction = _dereq_('./_a-function');
|
|
var toObject = _dereq_('./_to-object');
|
|
var IObject = _dereq_('./_iobject');
|
|
var toLength = _dereq_('./_to-length');
|
|
|
|
module.exports = function (that, callbackfn, aLen, memo, isRight) {
|
|
aFunction(callbackfn);
|
|
var O = toObject(that);
|
|
var self = IObject(O);
|
|
var length = toLength(O.length);
|
|
var index = isRight ? length - 1 : 0;
|
|
var i = isRight ? -1 : 1;
|
|
if (aLen < 2) for (;;) {
|
|
if (index in self) {
|
|
memo = self[index];
|
|
index += i;
|
|
break;
|
|
}
|
|
index += i;
|
|
if (isRight ? index < 0 : length <= index) {
|
|
throw TypeError('Reduce of empty array with no initial value');
|
|
}
|
|
}
|
|
for (;isRight ? index >= 0 : length > index; index += i) if (index in self) {
|
|
memo = callbackfn(memo, self[index], index, O);
|
|
}
|
|
return memo;
|
|
};
|
|
|
|
},{"./_a-function":8,"./_iobject":29,"./_to-length":48,"./_to-object":49}],13:[function(_dereq_,module,exports){
|
|
var isObject = _dereq_('./_is-object');
|
|
var isArray = _dereq_('./_is-array');
|
|
var SPECIES = _dereq_('./_wks')('species');
|
|
|
|
module.exports = function (original) {
|
|
var C;
|
|
if (isArray(original)) {
|
|
C = original.constructor;
|
|
// cross-realm fallback
|
|
if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
|
|
if (isObject(C)) {
|
|
C = C[SPECIES];
|
|
if (C === null) C = undefined;
|
|
}
|
|
} return C === undefined ? Array : C;
|
|
};
|
|
|
|
},{"./_is-array":30,"./_is-object":31,"./_wks":52}],14:[function(_dereq_,module,exports){
|
|
// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
|
|
var speciesConstructor = _dereq_('./_array-species-constructor');
|
|
|
|
module.exports = function (original, length) {
|
|
return new (speciesConstructor(original))(length);
|
|
};
|
|
|
|
},{"./_array-species-constructor":13}],15:[function(_dereq_,module,exports){
|
|
var toString = {}.toString;
|
|
|
|
module.exports = function (it) {
|
|
return toString.call(it).slice(8, -1);
|
|
};
|
|
|
|
},{}],16:[function(_dereq_,module,exports){
|
|
var core = module.exports = { version: '2.5.7' };
|
|
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
|
|
|
|
},{}],17:[function(_dereq_,module,exports){
|
|
// optional / simple context binding
|
|
var aFunction = _dereq_('./_a-function');
|
|
module.exports = function (fn, that, length) {
|
|
aFunction(fn);
|
|
if (that === undefined) return fn;
|
|
switch (length) {
|
|
case 1: return function (a) {
|
|
return fn.call(that, a);
|
|
};
|
|
case 2: return function (a, b) {
|
|
return fn.call(that, a, b);
|
|
};
|
|
case 3: return function (a, b, c) {
|
|
return fn.call(that, a, b, c);
|
|
};
|
|
}
|
|
return function (/* ...args */) {
|
|
return fn.apply(that, arguments);
|
|
};
|
|
};
|
|
|
|
},{"./_a-function":8}],18:[function(_dereq_,module,exports){
|
|
// 7.2.1 RequireObjectCoercible(argument)
|
|
module.exports = function (it) {
|
|
if (it == undefined) throw TypeError("Can't call method on " + it);
|
|
return it;
|
|
};
|
|
|
|
},{}],19:[function(_dereq_,module,exports){
|
|
// Thank's IE8 for his funny defineProperty
|
|
module.exports = !_dereq_('./_fails')(function () {
|
|
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
|
});
|
|
|
|
},{"./_fails":24}],20:[function(_dereq_,module,exports){
|
|
var isObject = _dereq_('./_is-object');
|
|
var document = _dereq_('./_global').document;
|
|
// typeof document.createElement is 'object' in old IE
|
|
var is = isObject(document) && isObject(document.createElement);
|
|
module.exports = function (it) {
|
|
return is ? document.createElement(it) : {};
|
|
};
|
|
|
|
},{"./_global":25,"./_is-object":31}],21:[function(_dereq_,module,exports){
|
|
// IE 8- don't enum bug keys
|
|
module.exports = (
|
|
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
|
|
).split(',');
|
|
|
|
},{}],22:[function(_dereq_,module,exports){
|
|
var global = _dereq_('./_global');
|
|
var core = _dereq_('./_core');
|
|
var ctx = _dereq_('./_ctx');
|
|
var hide = _dereq_('./_hide');
|
|
var has = _dereq_('./_has');
|
|
var PROTOTYPE = 'prototype';
|
|
|
|
var $export = function (type, name, source) {
|
|
var IS_FORCED = type & $export.F;
|
|
var IS_GLOBAL = type & $export.G;
|
|
var IS_STATIC = type & $export.S;
|
|
var IS_PROTO = type & $export.P;
|
|
var IS_BIND = type & $export.B;
|
|
var IS_WRAP = type & $export.W;
|
|
var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
|
|
var expProto = exports[PROTOTYPE];
|
|
var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
|
|
var key, own, out;
|
|
if (IS_GLOBAL) source = name;
|
|
for (key in source) {
|
|
// contains in native
|
|
own = !IS_FORCED && target && target[key] !== undefined;
|
|
if (own && has(exports, key)) continue;
|
|
// export native or passed
|
|
out = own ? target[key] : source[key];
|
|
// prevent global pollution for namespaces
|
|
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
|
|
// bind timers to global for call from export context
|
|
: IS_BIND && own ? ctx(out, global)
|
|
// wrap global constructors for prevent change them in library
|
|
: IS_WRAP && target[key] == out ? (function (C) {
|
|
var F = function (a, b, c) {
|
|
if (this instanceof C) {
|
|
switch (arguments.length) {
|
|
case 0: return new C();
|
|
case 1: return new C(a);
|
|
case 2: return new C(a, b);
|
|
} return new C(a, b, c);
|
|
} return C.apply(this, arguments);
|
|
};
|
|
F[PROTOTYPE] = C[PROTOTYPE];
|
|
return F;
|
|
// make static versions for prototype methods
|
|
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
|
|
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
|
|
if (IS_PROTO) {
|
|
(exports.virtual || (exports.virtual = {}))[key] = out;
|
|
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
|
|
if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
|
|
}
|
|
}
|
|
};
|
|
// type bitmap
|
|
$export.F = 1; // forced
|
|
$export.G = 2; // global
|
|
$export.S = 4; // static
|
|
$export.P = 8; // proto
|
|
$export.B = 16; // bind
|
|
$export.W = 32; // wrap
|
|
$export.U = 64; // safe
|
|
$export.R = 128; // real proto method for `library`
|
|
module.exports = $export;
|
|
|
|
},{"./_core":16,"./_ctx":17,"./_global":25,"./_has":26,"./_hide":27}],23:[function(_dereq_,module,exports){
|
|
var MATCH = _dereq_('./_wks')('match');
|
|
module.exports = function (KEY) {
|
|
var re = /./;
|
|
try {
|
|
'/./'[KEY](re);
|
|
} catch (e) {
|
|
try {
|
|
re[MATCH] = false;
|
|
return !'/./'[KEY](re);
|
|
} catch (f) { /* empty */ }
|
|
} return true;
|
|
};
|
|
|
|
},{"./_wks":52}],24:[function(_dereq_,module,exports){
|
|
module.exports = function (exec) {
|
|
try {
|
|
return !!exec();
|
|
} catch (e) {
|
|
return true;
|
|
}
|
|
};
|
|
|
|
},{}],25:[function(_dereq_,module,exports){
|
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
var global = module.exports = typeof window != 'undefined' && window.Math == Math
|
|
? window : typeof self != 'undefined' && self.Math == Math ? self
|
|
// eslint-disable-next-line no-new-func
|
|
: Function('return this')();
|
|
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
|
|
|
|
},{}],26:[function(_dereq_,module,exports){
|
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
module.exports = function (it, key) {
|
|
return hasOwnProperty.call(it, key);
|
|
};
|
|
|
|
},{}],27:[function(_dereq_,module,exports){
|
|
var dP = _dereq_('./_object-dp');
|
|
var createDesc = _dereq_('./_property-desc');
|
|
module.exports = _dereq_('./_descriptors') ? function (object, key, value) {
|
|
return dP.f(object, key, createDesc(1, value));
|
|
} : function (object, key, value) {
|
|
object[key] = value;
|
|
return object;
|
|
};
|
|
|
|
},{"./_descriptors":19,"./_object-dp":35,"./_property-desc":40}],28:[function(_dereq_,module,exports){
|
|
module.exports = !_dereq_('./_descriptors') && !_dereq_('./_fails')(function () {
|
|
return Object.defineProperty(_dereq_('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;
|
|
});
|
|
|
|
},{"./_descriptors":19,"./_dom-create":20,"./_fails":24}],29:[function(_dereq_,module,exports){
|
|
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
var cof = _dereq_('./_cof');
|
|
// eslint-disable-next-line no-prototype-builtins
|
|
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
|
|
return cof(it) == 'String' ? it.split('') : Object(it);
|
|
};
|
|
|
|
},{"./_cof":15}],30:[function(_dereq_,module,exports){
|
|
// 7.2.2 IsArray(argument)
|
|
var cof = _dereq_('./_cof');
|
|
module.exports = Array.isArray || function isArray(arg) {
|
|
return cof(arg) == 'Array';
|
|
};
|
|
|
|
},{"./_cof":15}],31:[function(_dereq_,module,exports){
|
|
module.exports = function (it) {
|
|
return typeof it === 'object' ? it !== null : typeof it === 'function';
|
|
};
|
|
|
|
},{}],32:[function(_dereq_,module,exports){
|
|
// 7.2.8 IsRegExp(argument)
|
|
var isObject = _dereq_('./_is-object');
|
|
var cof = _dereq_('./_cof');
|
|
var MATCH = _dereq_('./_wks')('match');
|
|
module.exports = function (it) {
|
|
var isRegExp;
|
|
return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
|
|
};
|
|
|
|
},{"./_cof":15,"./_is-object":31,"./_wks":52}],33:[function(_dereq_,module,exports){
|
|
module.exports = true;
|
|
|
|
},{}],34:[function(_dereq_,module,exports){
|
|
'use strict';
|
|
// 19.1.2.1 Object.assign(target, source, ...)
|
|
var getKeys = _dereq_('./_object-keys');
|
|
var gOPS = _dereq_('./_object-gops');
|
|
var pIE = _dereq_('./_object-pie');
|
|
var toObject = _dereq_('./_to-object');
|
|
var IObject = _dereq_('./_iobject');
|
|
var $assign = Object.assign;
|
|
|
|
// should work with symbols and should have deterministic property order (V8 bug)
|
|
module.exports = !$assign || _dereq_('./_fails')(function () {
|
|
var A = {};
|
|
var B = {};
|
|
// eslint-disable-next-line no-undef
|
|
var S = Symbol();
|
|
var K = 'abcdefghijklmnopqrst';
|
|
A[S] = 7;
|
|
K.split('').forEach(function (k) { B[k] = k; });
|
|
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
|
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
|
|
var T = toObject(target);
|
|
var aLen = arguments.length;
|
|
var index = 1;
|
|
var getSymbols = gOPS.f;
|
|
var isEnum = pIE.f;
|
|
while (aLen > index) {
|
|
var S = IObject(arguments[index++]);
|
|
var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
|
|
var length = keys.length;
|
|
var j = 0;
|
|
var key;
|
|
while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
|
|
} return T;
|
|
} : $assign;
|
|
|
|
},{"./_fails":24,"./_iobject":29,"./_object-gops":36,"./_object-keys":38,"./_object-pie":39,"./_to-object":49}],35:[function(_dereq_,module,exports){
|
|
var anObject = _dereq_('./_an-object');
|
|
var IE8_DOM_DEFINE = _dereq_('./_ie8-dom-define');
|
|
var toPrimitive = _dereq_('./_to-primitive');
|
|
var dP = Object.defineProperty;
|
|
|
|
exports.f = _dereq_('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {
|
|
anObject(O);
|
|
P = toPrimitive(P, true);
|
|
anObject(Attributes);
|
|
if (IE8_DOM_DEFINE) try {
|
|
return dP(O, P, Attributes);
|
|
} catch (e) { /* empty */ }
|
|
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
|
|
if ('value' in Attributes) O[P] = Attributes.value;
|
|
return O;
|
|
};
|
|
|
|
},{"./_an-object":9,"./_descriptors":19,"./_ie8-dom-define":28,"./_to-primitive":50}],36:[function(_dereq_,module,exports){
|
|
exports.f = Object.getOwnPropertySymbols;
|
|
|
|
},{}],37:[function(_dereq_,module,exports){
|
|
var has = _dereq_('./_has');
|
|
var toIObject = _dereq_('./_to-iobject');
|
|
var arrayIndexOf = _dereq_('./_array-includes')(false);
|
|
var IE_PROTO = _dereq_('./_shared-key')('IE_PROTO');
|
|
|
|
module.exports = function (object, names) {
|
|
var O = toIObject(object);
|
|
var i = 0;
|
|
var result = [];
|
|
var key;
|
|
for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
|
|
// Don't enum bug & hidden keys
|
|
while (names.length > i) if (has(O, key = names[i++])) {
|
|
~arrayIndexOf(result, key) || result.push(key);
|
|
}
|
|
return result;
|
|
};
|
|
|
|
},{"./_array-includes":10,"./_has":26,"./_shared-key":41,"./_to-iobject":47}],38:[function(_dereq_,module,exports){
|
|
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
|
|
var $keys = _dereq_('./_object-keys-internal');
|
|
var enumBugKeys = _dereq_('./_enum-bug-keys');
|
|
|
|
module.exports = Object.keys || function keys(O) {
|
|
return $keys(O, enumBugKeys);
|
|
};
|
|
|
|
},{"./_enum-bug-keys":21,"./_object-keys-internal":37}],39:[function(_dereq_,module,exports){
|
|
exports.f = {}.propertyIsEnumerable;
|
|
|
|
},{}],40:[function(_dereq_,module,exports){
|
|
module.exports = function (bitmap, value) {
|
|
return {
|
|
enumerable: !(bitmap & 1),
|
|
configurable: !(bitmap & 2),
|
|
writable: !(bitmap & 4),
|
|
value: value
|
|
};
|
|
};
|
|
|
|
},{}],41:[function(_dereq_,module,exports){
|
|
var shared = _dereq_('./_shared')('keys');
|
|
var uid = _dereq_('./_uid');
|
|
module.exports = function (key) {
|
|
return shared[key] || (shared[key] = uid(key));
|
|
};
|
|
|
|
},{"./_shared":42,"./_uid":51}],42:[function(_dereq_,module,exports){
|
|
var core = _dereq_('./_core');
|
|
var global = _dereq_('./_global');
|
|
var SHARED = '__core-js_shared__';
|
|
var store = global[SHARED] || (global[SHARED] = {});
|
|
|
|
(module.exports = function (key, value) {
|
|
return store[key] || (store[key] = value !== undefined ? value : {});
|
|
})('versions', []).push({
|
|
version: core.version,
|
|
mode: _dereq_('./_library') ? 'pure' : 'global',
|
|
copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
|
|
});
|
|
|
|
},{"./_core":16,"./_global":25,"./_library":33}],43:[function(_dereq_,module,exports){
|
|
'use strict';
|
|
var fails = _dereq_('./_fails');
|
|
|
|
module.exports = function (method, arg) {
|
|
return !!method && fails(function () {
|
|
// eslint-disable-next-line no-useless-call
|
|
arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);
|
|
});
|
|
};
|
|
|
|
},{"./_fails":24}],44:[function(_dereq_,module,exports){
|
|
// helper for String#{startsWith, endsWith, includes}
|
|
var isRegExp = _dereq_('./_is-regexp');
|
|
var defined = _dereq_('./_defined');
|
|
|
|
module.exports = function (that, searchString, NAME) {
|
|
if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!");
|
|
return String(defined(that));
|
|
};
|
|
|
|
},{"./_defined":18,"./_is-regexp":32}],45:[function(_dereq_,module,exports){
|
|
var toInteger = _dereq_('./_to-integer');
|
|
var max = Math.max;
|
|
var min = Math.min;
|
|
module.exports = function (index, length) {
|
|
index = toInteger(index);
|
|
return index < 0 ? max(index + length, 0) : min(index, length);
|
|
};
|
|
|
|
},{"./_to-integer":46}],46:[function(_dereq_,module,exports){
|
|
// 7.1.4 ToInteger
|
|
var ceil = Math.ceil;
|
|
var floor = Math.floor;
|
|
module.exports = function (it) {
|
|
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
|
|
};
|
|
|
|
},{}],47:[function(_dereq_,module,exports){
|
|
// to indexed object, toObject with fallback for non-array-like ES3 strings
|
|
var IObject = _dereq_('./_iobject');
|
|
var defined = _dereq_('./_defined');
|
|
module.exports = function (it) {
|
|
return IObject(defined(it));
|
|
};
|
|
|
|
},{"./_defined":18,"./_iobject":29}],48:[function(_dereq_,module,exports){
|
|
// 7.1.15 ToLength
|
|
var toInteger = _dereq_('./_to-integer');
|
|
var min = Math.min;
|
|
module.exports = function (it) {
|
|
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
|
|
};
|
|
|
|
},{"./_to-integer":46}],49:[function(_dereq_,module,exports){
|
|
// 7.1.13 ToObject(argument)
|
|
var defined = _dereq_('./_defined');
|
|
module.exports = function (it) {
|
|
return Object(defined(it));
|
|
};
|
|
|
|
},{"./_defined":18}],50:[function(_dereq_,module,exports){
|
|
// 7.1.1 ToPrimitive(input [, PreferredType])
|
|
var isObject = _dereq_('./_is-object');
|
|
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
|
|
// and the second argument - flag - preferred type is a string
|
|
module.exports = function (it, S) {
|
|
if (!isObject(it)) return it;
|
|
var fn, val;
|
|
if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
|
if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
|
|
if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
|
throw TypeError("Can't convert object to primitive value");
|
|
};
|
|
|
|
},{"./_is-object":31}],51:[function(_dereq_,module,exports){
|
|
var id = 0;
|
|
var px = Math.random();
|
|
module.exports = function (key) {
|
|
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
|
};
|
|
|
|
},{}],52:[function(_dereq_,module,exports){
|
|
var store = _dereq_('./_shared')('wks');
|
|
var uid = _dereq_('./_uid');
|
|
var Symbol = _dereq_('./_global').Symbol;
|
|
var USE_SYMBOL = typeof Symbol == 'function';
|
|
|
|
var $exports = module.exports = function (name) {
|
|
return store[name] || (store[name] =
|
|
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
|
|
};
|
|
|
|
$exports.store = store;
|
|
|
|
},{"./_global":25,"./_shared":42,"./_uid":51}],53:[function(_dereq_,module,exports){
|
|
'use strict';
|
|
var $export = _dereq_('./_export');
|
|
var $filter = _dereq_('./_array-methods')(2);
|
|
|
|
$export($export.P + $export.F * !_dereq_('./_strict-method')([].filter, true), 'Array', {
|
|
// 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
|
|
filter: function filter(callbackfn /* , thisArg */) {
|
|
return $filter(this, callbackfn, arguments[1]);
|
|
}
|
|
});
|
|
|
|
},{"./_array-methods":11,"./_export":22,"./_strict-method":43}],54:[function(_dereq_,module,exports){
|
|
'use strict';
|
|
var $export = _dereq_('./_export');
|
|
var $forEach = _dereq_('./_array-methods')(0);
|
|
var STRICT = _dereq_('./_strict-method')([].forEach, true);
|
|
|
|
$export($export.P + $export.F * !STRICT, 'Array', {
|
|
// 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
|
|
forEach: function forEach(callbackfn /* , thisArg */) {
|
|
return $forEach(this, callbackfn, arguments[1]);
|
|
}
|
|
});
|
|
|
|
},{"./_array-methods":11,"./_export":22,"./_strict-method":43}],55:[function(_dereq_,module,exports){
|
|
'use strict';
|
|
var $export = _dereq_('./_export');
|
|
var $indexOf = _dereq_('./_array-includes')(false);
|
|
var $native = [].indexOf;
|
|
var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;
|
|
|
|
$export($export.P + $export.F * (NEGATIVE_ZERO || !_dereq_('./_strict-method')($native)), 'Array', {
|
|
// 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
|
|
indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
|
|
return NEGATIVE_ZERO
|
|
// convert -0 to +0
|
|
? $native.apply(this, arguments) || 0
|
|
: $indexOf(this, searchElement, arguments[1]);
|
|
}
|
|
});
|
|
|
|
},{"./_array-includes":10,"./_export":22,"./_strict-method":43}],56:[function(_dereq_,module,exports){
|
|
'use strict';
|
|
var $export = _dereq_('./_export');
|
|
var $reduce = _dereq_('./_array-reduce');
|
|
|
|
$export($export.P + $export.F * !_dereq_('./_strict-method')([].reduceRight, true), 'Array', {
|
|
// 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
|
|
reduceRight: function reduceRight(callbackfn /* , initialValue */) {
|
|
return $reduce(this, callbackfn, arguments.length, arguments[1], true);
|
|
}
|
|
});
|
|
|
|
},{"./_array-reduce":12,"./_export":22,"./_strict-method":43}],57:[function(_dereq_,module,exports){
|
|
// 19.1.3.1 Object.assign(target, source)
|
|
var $export = _dereq_('./_export');
|
|
|
|
$export($export.S + $export.F, 'Object', { assign: _dereq_('./_object-assign') });
|
|
|
|
},{"./_export":22,"./_object-assign":34}],58:[function(_dereq_,module,exports){
|
|
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
|
|
'use strict';
|
|
var $export = _dereq_('./_export');
|
|
var toLength = _dereq_('./_to-length');
|
|
var context = _dereq_('./_string-context');
|
|
var ENDS_WITH = 'endsWith';
|
|
var $endsWith = ''[ENDS_WITH];
|
|
|
|
$export($export.P + $export.F * _dereq_('./_fails-is-regexp')(ENDS_WITH), 'String', {
|
|
endsWith: function endsWith(searchString /* , endPosition = @length */) {
|
|
var that = context(this, searchString, ENDS_WITH);
|
|
var endPosition = arguments.length > 1 ? arguments[1] : undefined;
|
|
var len = toLength(that.length);
|
|
var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len);
|
|
var search = String(searchString);
|
|
return $endsWith
|
|
? $endsWith.call(that, search, end)
|
|
: that.slice(end - search.length, end) === search;
|
|
}
|
|
});
|
|
|
|
},{"./_export":22,"./_fails-is-regexp":23,"./_string-context":44,"./_to-length":48}],59:[function(_dereq_,module,exports){
|
|
var traverse = module.exports = function (obj) {
|
|
return new Traverse(obj);
|
|
};
|
|
|
|
function Traverse (obj) {
|
|
this.value = obj;
|
|
}
|
|
|
|
Traverse.prototype.get = function (ps) {
|
|
var node = this.value;
|
|
for (var i = 0; i < ps.length; i ++) {
|
|
var key = ps[i];
|
|
if (!node || !hasOwnProperty.call(node, key)) {
|
|
node = undefined;
|
|
break;
|
|
}
|
|
node = node[key];
|
|
}
|
|
return node;
|
|
};
|
|
|
|
Traverse.prototype.has = function (ps) {
|
|
var node = this.value;
|
|
for (var i = 0; i < ps.length; i ++) {
|
|
var key = ps[i];
|
|
if (!node || !hasOwnProperty.call(node, key)) {
|
|
return false;
|
|
}
|
|
node = node[key];
|
|
}
|
|
return true;
|
|
};
|
|
|
|
Traverse.prototype.set = function (ps, value) {
|
|
var node = this.value;
|
|
for (var i = 0; i < ps.length - 1; i ++) {
|
|
var key = ps[i];
|
|
if (!hasOwnProperty.call(node, key)) node[key] = {};
|
|
node = node[key];
|
|
}
|
|
node[ps[i]] = value;
|
|
return value;
|
|
};
|
|
|
|
Traverse.prototype.map = function (cb) {
|
|
return walk(this.value, cb, true);
|
|
};
|
|
|
|
Traverse.prototype.forEach = function (cb) {
|
|
this.value = walk(this.value, cb, false);
|
|
return this.value;
|
|
};
|
|
|
|
Traverse.prototype.reduce = function (cb, init) {
|
|
var skip = arguments.length === 1;
|
|
var acc = skip ? this.value : init;
|
|
this.forEach(function (x) {
|
|
if (!this.isRoot || !skip) {
|
|
acc = cb.call(this, acc, x);
|
|
}
|
|
});
|
|
return acc;
|
|
};
|
|
|
|
Traverse.prototype.paths = function () {
|
|
var acc = [];
|
|
this.forEach(function (x) {
|
|
acc.push(this.path);
|
|
});
|
|
return acc;
|
|
};
|
|
|
|
Traverse.prototype.nodes = function () {
|
|
var acc = [];
|
|
this.forEach(function (x) {
|
|
acc.push(this.node);
|
|
});
|
|
return acc;
|
|
};
|
|
|
|
Traverse.prototype.clone = function () {
|
|
var parents = [], nodes = [];
|
|
|
|
return (function clone (src) {
|
|
for (var i = 0; i < parents.length; i++) {
|
|
if (parents[i] === src) {
|
|
return nodes[i];
|
|
}
|
|
}
|
|
|
|
if (typeof src === 'object' && src !== null) {
|
|
var dst = copy(src);
|
|
|
|
parents.push(src);
|
|
nodes.push(dst);
|
|
|
|
forEach(objectKeys(src), function (key) {
|
|
dst[key] = clone(src[key]);
|
|
});
|
|
|
|
parents.pop();
|
|
nodes.pop();
|
|
return dst;
|
|
}
|
|
else {
|
|
return src;
|
|
}
|
|
})(this.value);
|
|
};
|
|
|
|
function walk (root, cb, immutable) {
|
|
var path = [];
|
|
var parents = [];
|
|
var alive = true;
|
|
|
|
return (function walker (node_) {
|
|
var node = immutable ? copy(node_) : node_;
|
|
var modifiers = {};
|
|
|
|
var keepGoing = true;
|
|
|
|
var state = {
|
|
node : node,
|
|
node_ : node_,
|
|
path : [].concat(path),
|
|
parent : parents[parents.length - 1],
|
|
parents : parents,
|
|
key : path.slice(-1)[0],
|
|
isRoot : path.length === 0,
|
|
level : path.length,
|
|
circular : null,
|
|
update : function (x, stopHere) {
|
|
if (!state.isRoot) {
|
|
state.parent.node[state.key] = x;
|
|
}
|
|
state.node = x;
|
|
if (stopHere) keepGoing = false;
|
|
},
|
|
'delete' : function (stopHere) {
|
|
delete state.parent.node[state.key];
|
|
if (stopHere) keepGoing = false;
|
|
},
|
|
remove : function (stopHere) {
|
|
if (isArray(state.parent.node)) {
|
|
state.parent.node.splice(state.key, 1);
|
|
}
|
|
else {
|
|
delete state.parent.node[state.key];
|
|
}
|
|
if (stopHere) keepGoing = false;
|
|
},
|
|
keys : null,
|
|
before : function (f) { modifiers.before = f },
|
|
after : function (f) { modifiers.after = f },
|
|
pre : function (f) { modifiers.pre = f },
|
|
post : function (f) { modifiers.post = f },
|
|
stop : function () { alive = false },
|
|
block : function () { keepGoing = false }
|
|
};
|
|
|
|
if (!alive) return state;
|
|
|
|
function updateState() {
|
|
if (typeof state.node === 'object' && state.node !== null) {
|
|
if (!state.keys || state.node_ !== state.node) {
|
|
state.keys = objectKeys(state.node)
|
|
}
|
|
|
|
state.isLeaf = state.keys.length == 0;
|
|
|
|
for (var i = 0; i < parents.length; i++) {
|
|
if (parents[i].node_ === node_) {
|
|
state.circular = parents[i];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
state.isLeaf = true;
|
|
state.keys = null;
|
|
}
|
|
|
|
state.notLeaf = !state.isLeaf;
|
|
state.notRoot = !state.isRoot;
|
|
}
|
|
|
|
updateState();
|
|
|
|
// use return values to update if defined
|
|
var ret = cb.call(state, state.node);
|
|
if (ret !== undefined && state.update) state.update(ret);
|
|
|
|
if (modifiers.before) modifiers.before.call(state, state.node);
|
|
|
|
if (!keepGoing) return state;
|
|
|
|
if (typeof state.node == 'object'
|
|
&& state.node !== null && !state.circular) {
|
|
parents.push(state);
|
|
|
|
updateState();
|
|
|
|
forEach(state.keys, function (key, i) {
|
|
path.push(key);
|
|
|
|
if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);
|
|
|
|
var child = walker(state.node[key]);
|
|
if (immutable && hasOwnProperty.call(state.node, key)) {
|
|
state.node[key] = child.node;
|
|
}
|
|
|
|
child.isLast = i == state.keys.length - 1;
|
|
child.isFirst = i == 0;
|
|
|
|
if (modifiers.post) modifiers.post.call(state, child);
|
|
|
|
path.pop();
|
|
});
|
|
parents.pop();
|
|
}
|
|
|
|
if (modifiers.after) modifiers.after.call(state, state.node);
|
|
|
|
return state;
|
|
})(root).node;
|
|
}
|
|
|
|
function copy (src) {
|
|
if (typeof src === 'object' && src !== null) {
|
|
var dst;
|
|
|
|
if (isArray(src)) {
|
|
dst = [];
|
|
}
|
|
else if (isDate(src)) {
|
|
dst = new Date(src.getTime ? src.getTime() : src);
|
|
}
|
|
else if (isRegExp(src)) {
|
|
dst = new RegExp(src);
|
|
}
|
|
else if (isError(src)) {
|
|
dst = { message: src.message };
|
|
}
|
|
else if (isBoolean(src)) {
|
|
dst = new Boolean(src);
|
|
}
|
|
else if (isNumber(src)) {
|
|
dst = new Number(src);
|
|
}
|
|
else if (isString(src)) {
|
|
dst = new String(src);
|
|
}
|
|
else if (Object.create && Object.getPrototypeOf) {
|
|
dst = Object.create(Object.getPrototypeOf(src));
|
|
}
|
|
else if (src.constructor === Object) {
|
|
dst = {};
|
|
}
|
|
else {
|
|
var proto =
|
|
(src.constructor && src.constructor.prototype)
|
|
|| src.__proto__
|
|
|| {}
|
|
;
|
|
var T = function () {};
|
|
T.prototype = proto;
|
|
dst = new T;
|
|
}
|
|
|
|
forEach(objectKeys(src), function (key) {
|
|
dst[key] = src[key];
|
|
});
|
|
return dst;
|
|
}
|
|
else return src;
|
|
}
|
|
|
|
var objectKeys = Object.keys || function keys (obj) {
|
|
var res = [];
|
|
for (var key in obj) res.push(key)
|
|
return res;
|
|
};
|
|
|
|
function toS (obj) { return Object.prototype.toString.call(obj) }
|
|
function isDate (obj) { return toS(obj) === '[object Date]' }
|
|
function isRegExp (obj) { return toS(obj) === '[object RegExp]' }
|
|
function isError (obj) { return toS(obj) === '[object Error]' }
|
|
function isBoolean (obj) { return toS(obj) === '[object Boolean]' }
|
|
function isNumber (obj) { return toS(obj) === '[object Number]' }
|
|
function isString (obj) { return toS(obj) === '[object String]' }
|
|
|
|
var isArray = Array.isArray || function isArray (xs) {
|
|
return Object.prototype.toString.call(xs) === '[object Array]';
|
|
};
|
|
|
|
var forEach = function (xs, fn) {
|
|
if (xs.forEach) return xs.forEach(fn)
|
|
else for (var i = 0; i < xs.length; i++) {
|
|
fn(xs[i], i, xs);
|
|
}
|
|
};
|
|
|
|
forEach(objectKeys(Traverse.prototype), function (key) {
|
|
traverse[key] = function (obj) {
|
|
var args = [].slice.call(arguments, 1);
|
|
var t = new Traverse(obj);
|
|
return t[key].apply(t, args);
|
|
};
|
|
});
|
|
|
|
var hasOwnProperty = Object.hasOwnProperty || function (obj, key) {
|
|
return key in obj;
|
|
};
|
|
|
|
},{}],60:[function(_dereq_,module,exports){
|
|
/**
|
|
* type-name - Just a reasonable typeof
|
|
*
|
|
* https://github.com/twada/type-name
|
|
*
|
|
* Copyright (c) 2014-2016 Takuto Wada
|
|
* Licensed under the MIT license.
|
|
* https://github.com/twada/type-name/blob/master/LICENSE
|
|
*/
|
|
'use strict';
|
|
|
|
var toStr = Object.prototype.toString;
|
|
|
|
function funcName (f) {
|
|
if (f.name) {
|
|
return f.name;
|
|
}
|
|
var match = /^\s*function\s*([^\(]*)/im.exec(f.toString());
|
|
return match ? match[1] : '';
|
|
}
|
|
|
|
function ctorName (obj) {
|
|
var strName = toStr.call(obj).slice(8, -1);
|
|
if ((strName === 'Object' || strName === 'Error') && obj.constructor) {
|
|
return funcName(obj.constructor);
|
|
}
|
|
return strName;
|
|
}
|
|
|
|
function typeName (val) {
|
|
var type;
|
|
if (val === null) {
|
|
return 'null';
|
|
}
|
|
type = typeof val;
|
|
if (type === 'object') {
|
|
return ctorName(val);
|
|
}
|
|
return type;
|
|
}
|
|
|
|
module.exports = typeName;
|
|
|
|
},{}],61:[function(_dereq_,module,exports){
|
|
'use strict';
|
|
|
|
var typeName = _dereq_('type-name');
|
|
var forEach = _dereq_('core-js/library/fn/array/for-each');
|
|
var arrayFilter = _dereq_('core-js/library/fn/array/filter');
|
|
var reduceRight = _dereq_('core-js/library/fn/array/reduce-right');
|
|
var indexOf = _dereq_('core-js/library/fn/array/index-of');
|
|
var slice = Array.prototype.slice;
|
|
var END = {};
|
|
var ITERATE = {};
|
|
|
|
// arguments should end with end or iterate
|
|
function compose () {
|
|
var filters = slice.apply(arguments);
|
|
return reduceRight(filters, function(right, left) {
|
|
return left(right);
|
|
});
|
|
}
|
|
|
|
// skip children
|
|
function end () {
|
|
return function (acc, x) {
|
|
acc.context.keys = [];
|
|
return END;
|
|
};
|
|
}
|
|
|
|
// iterate children
|
|
function iterate () {
|
|
return function (acc, x) {
|
|
return ITERATE;
|
|
};
|
|
}
|
|
|
|
function filter (predicate) {
|
|
return function (next) {
|
|
return function (acc, x) {
|
|
var toBeIterated;
|
|
var isIteratingArray = (typeName(x) === 'Array');
|
|
if (typeName(predicate) === 'function') {
|
|
toBeIterated = [];
|
|
forEach(acc.context.keys, function (key) {
|
|
var indexOrKey = isIteratingArray ? parseInt(key, 10) : key;
|
|
var kvp = {
|
|
key: indexOrKey,
|
|
value: x[key]
|
|
};
|
|
var decision = predicate(kvp);
|
|
if (decision) {
|
|
toBeIterated.push(key);
|
|
}
|
|
if (typeName(decision) === 'number') {
|
|
truncateByKey(decision, key, acc);
|
|
}
|
|
if (typeName(decision) === 'function') {
|
|
customizeStrategyForKey(decision, key, acc);
|
|
}
|
|
});
|
|
acc.context.keys = toBeIterated;
|
|
}
|
|
return next(acc, x);
|
|
};
|
|
};
|
|
}
|
|
|
|
function customizeStrategyForKey (strategy, key, acc) {
|
|
acc.handlers[currentPath(key, acc)] = strategy;
|
|
}
|
|
|
|
function truncateByKey (size, key, acc) {
|
|
acc.handlers[currentPath(key, acc)] = size;
|
|
}
|
|
|
|
function currentPath (key, acc) {
|
|
var pathToCurrentNode = [''].concat(acc.context.path);
|
|
if (typeName(key) !== 'undefined') {
|
|
pathToCurrentNode.push(key);
|
|
}
|
|
return pathToCurrentNode.join('/');
|
|
}
|
|
|
|
function allowedKeys (orderedWhiteList) {
|
|
return function (next) {
|
|
return function (acc, x) {
|
|
var isIteratingArray = (typeName(x) === 'Array');
|
|
if (!isIteratingArray && typeName(orderedWhiteList) === 'Array') {
|
|
acc.context.keys = arrayFilter(orderedWhiteList, function (propKey) {
|
|
return x.hasOwnProperty(propKey);
|
|
});
|
|
}
|
|
return next(acc, x);
|
|
};
|
|
};
|
|
}
|
|
|
|
function safeKeys () {
|
|
return function (next) {
|
|
return function (acc, x) {
|
|
if (typeName(x) !== 'Array') {
|
|
acc.context.keys = arrayFilter(acc.context.keys, function (propKey) {
|
|
// Error handling for unsafe property access.
|
|
// For example, on PhantomJS,
|
|
// accessing HTMLInputElement.selectionEnd causes TypeError
|
|
try {
|
|
var val = x[propKey];
|
|
return true;
|
|
} catch (e) {
|
|
// skip unsafe key
|
|
return false;
|
|
}
|
|
});
|
|
}
|
|
return next(acc, x);
|
|
};
|
|
};
|
|
}
|
|
|
|
function arrayIndicesToKeys () {
|
|
return function (next) {
|
|
return function (acc, x) {
|
|
if (typeName(x) === 'Array' && 0 < x.length) {
|
|
var indices = Array(x.length);
|
|
for(var i = 0; i < x.length; i += 1) {
|
|
indices[i] = String(i); // traverse uses strings as keys
|
|
}
|
|
acc.context.keys = indices;
|
|
}
|
|
return next(acc, x);
|
|
};
|
|
};
|
|
}
|
|
|
|
function when (guard, then) {
|
|
return function (next) {
|
|
return function (acc, x) {
|
|
var kvp = {
|
|
key: acc.context.key,
|
|
value: x
|
|
};
|
|
if (guard(kvp, acc)) {
|
|
return then(acc, x);
|
|
}
|
|
return next(acc, x);
|
|
};
|
|
};
|
|
}
|
|
|
|
function truncate (size) {
|
|
return function (next) {
|
|
return function (acc, x) {
|
|
var orig = acc.push;
|
|
var ret;
|
|
acc.push = function (str) {
|
|
var savings = str.length - size;
|
|
var truncated;
|
|
if (savings <= size) {
|
|
orig.call(acc, str);
|
|
} else {
|
|
truncated = str.substring(0, size);
|
|
orig.call(acc, truncated + acc.options.snip);
|
|
}
|
|
};
|
|
ret = next(acc, x);
|
|
acc.push = orig;
|
|
return ret;
|
|
};
|
|
};
|
|
}
|
|
|
|
function constructorName () {
|
|
return function (next) {
|
|
return function (acc, x) {
|
|
var name = acc.options.typeFun(x);
|
|
if (name === '') {
|
|
name = acc.options.anonymous;
|
|
}
|
|
acc.push(name);
|
|
return next(acc, x);
|
|
};
|
|
};
|
|
}
|
|
|
|
function always (str) {
|
|
return function (next) {
|
|
return function (acc, x) {
|
|
acc.push(str);
|
|
return next(acc, x);
|
|
};
|
|
};
|
|
}
|
|
|
|
function optionValue (key) {
|
|
return function (next) {
|
|
return function (acc, x) {
|
|
acc.push(acc.options[key]);
|
|
return next(acc, x);
|
|
};
|
|
};
|
|
}
|
|
|
|
function json (replacer) {
|
|
return function (next) {
|
|
return function (acc, x) {
|
|
acc.push(JSON.stringify(x, replacer));
|
|
return next(acc, x);
|
|
};
|
|
};
|
|
}
|
|
|
|
function toStr () {
|
|
return function (next) {
|
|
return function (acc, x) {
|
|
acc.push(x.toString());
|
|
return next(acc, x);
|
|
};
|
|
};
|
|
}
|
|
|
|
function decorateArray () {
|
|
return function (next) {
|
|
return function (acc, x) {
|
|
acc.context.before(function (node) {
|
|
acc.push('[');
|
|
});
|
|
acc.context.after(function (node) {
|
|
afterAllChildren(this, acc.push, acc.options);
|
|
acc.push(']');
|
|
});
|
|
acc.context.pre(function (val, key) {
|
|
beforeEachChild(this, acc.push, acc.options);
|
|
});
|
|
acc.context.post(function (childContext) {
|
|
afterEachChild(childContext, acc.push);
|
|
});
|
|
return next(acc, x);
|
|
};
|
|
};
|
|
}
|
|
|
|
function decorateObject () {
|
|
return function (next) {
|
|
return function (acc, x) {
|
|
acc.context.before(function (node) {
|
|
acc.push('{');
|
|
});
|
|
acc.context.after(function (node) {
|
|
afterAllChildren(this, acc.push, acc.options);
|
|
acc.push('}');
|
|
});
|
|
acc.context.pre(function (val, key) {
|
|
beforeEachChild(this, acc.push, acc.options);
|
|
acc.push(sanitizeKey(key) + (acc.options.indent ? ': ' : ':'));
|
|
});
|
|
acc.context.post(function (childContext) {
|
|
afterEachChild(childContext, acc.push);
|
|
});
|
|
return next(acc, x);
|
|
};
|
|
};
|
|
}
|
|
|
|
function sanitizeKey (key) {
|
|
return /^[A-Za-z_]+$/.test(key) ? key : JSON.stringify(key);
|
|
}
|
|
|
|
function afterAllChildren (context, push, options) {
|
|
if (options.indent && 0 < context.keys.length) {
|
|
push(options.lineSeparator);
|
|
for(var i = 0; i < context.level; i += 1) { // indent level - 1
|
|
push(options.indent);
|
|
}
|
|
}
|
|
}
|
|
|
|
function beforeEachChild (context, push, options) {
|
|
if (options.indent) {
|
|
push(options.lineSeparator);
|
|
for(var i = 0; i <= context.level; i += 1) {
|
|
push(options.indent);
|
|
}
|
|
}
|
|
}
|
|
|
|
function afterEachChild (childContext, push) {
|
|
if (!childContext.isLast) {
|
|
push(',');
|
|
}
|
|
}
|
|
|
|
function nan (kvp, acc) {
|
|
return kvp.value !== kvp.value;
|
|
}
|
|
|
|
function positiveInfinity (kvp, acc) {
|
|
return !isFinite(kvp.value) && kvp.value === Infinity;
|
|
}
|
|
|
|
function negativeInfinity (kvp, acc) {
|
|
return !isFinite(kvp.value) && kvp.value !== Infinity;
|
|
}
|
|
|
|
function circular (kvp, acc) {
|
|
return acc.context.circular;
|
|
}
|
|
|
|
function maxDepth (kvp, acc) {
|
|
return (acc.options.maxDepth && acc.options.maxDepth <= acc.context.level);
|
|
}
|
|
|
|
var prune = compose(
|
|
always('#'),
|
|
constructorName(),
|
|
always('#'),
|
|
end()
|
|
);
|
|
var omitNaN = when(nan, compose(
|
|
always('NaN'),
|
|
end()
|
|
));
|
|
var omitPositiveInfinity = when(positiveInfinity, compose(
|
|
always('Infinity'),
|
|
end()
|
|
));
|
|
var omitNegativeInfinity = when(negativeInfinity, compose(
|
|
always('-Infinity'),
|
|
end()
|
|
));
|
|
var omitCircular = when(circular, compose(
|
|
optionValue('circular'),
|
|
end()
|
|
));
|
|
var omitMaxDepth = when(maxDepth, prune);
|
|
|
|
module.exports = {
|
|
filters: {
|
|
always: always,
|
|
optionValue: optionValue,
|
|
constructorName: constructorName,
|
|
json: json,
|
|
toStr: toStr,
|
|
prune: prune,
|
|
truncate: truncate,
|
|
decorateArray: decorateArray,
|
|
decorateObject: decorateObject
|
|
},
|
|
flow: {
|
|
compose: compose,
|
|
when: when,
|
|
allowedKeys: allowedKeys,
|
|
safeKeys: safeKeys,
|
|
arrayIndicesToKeys: arrayIndicesToKeys,
|
|
filter: filter,
|
|
iterate: iterate,
|
|
end: end
|
|
},
|
|
symbols: {
|
|
END: END,
|
|
ITERATE: ITERATE
|
|
},
|
|
always: function (str) {
|
|
return compose(always(str), end());
|
|
},
|
|
json: function () {
|
|
return compose(json(), end());
|
|
},
|
|
toStr: function () {
|
|
return compose(toStr(), end());
|
|
},
|
|
prune: function () {
|
|
return prune;
|
|
},
|
|
number: function () {
|
|
return compose(
|
|
omitNaN,
|
|
omitPositiveInfinity,
|
|
omitNegativeInfinity,
|
|
json(),
|
|
end()
|
|
);
|
|
},
|
|
newLike: function () {
|
|
return compose(
|
|
always('new '),
|
|
constructorName(),
|
|
always('('),
|
|
json(),
|
|
always(')'),
|
|
end()
|
|
);
|
|
},
|
|
array: function (predicate) {
|
|
return compose(
|
|
omitCircular,
|
|
omitMaxDepth,
|
|
decorateArray(),
|
|
arrayIndicesToKeys(),
|
|
filter(predicate),
|
|
iterate()
|
|
);
|
|
},
|
|
object: function (predicate, orderedWhiteList) {
|
|
return compose(
|
|
omitCircular,
|
|
omitMaxDepth,
|
|
constructorName(),
|
|
decorateObject(),
|
|
allowedKeys(orderedWhiteList),
|
|
safeKeys(),
|
|
filter(predicate),
|
|
iterate()
|
|
);
|
|
}
|
|
};
|
|
|
|
},{"core-js/library/fn/array/filter":2,"core-js/library/fn/array/for-each":3,"core-js/library/fn/array/index-of":4,"core-js/library/fn/array/reduce-right":5,"type-name":60}]},{},[1])(1)
|
|
});
|