stringifier.js 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591
  1. /**
  2. * Modules in this bundle
  3. * @license
  4. *
  5. * stringifier:
  6. * license: MIT (http://opensource.org/licenses/MIT)
  7. * author: Takuto Wada <takuto.wada@gmail.com>
  8. * homepage: https://github.com/twada/stringifier
  9. * version: 1.4.0
  10. *
  11. * core-js:
  12. * license: MIT (http://opensource.org/licenses/MIT)
  13. * homepage: https://github.com/zloirock/core-js#readme
  14. * version: 2.5.7
  15. *
  16. * traverse:
  17. * license: MIT (http://opensource.org/licenses/MIT)
  18. * author: James Halliday <mail@substack.net>
  19. * homepage: https://github.com/substack/js-traverse
  20. * version: 0.6.6
  21. *
  22. * type-name:
  23. * license: MIT (http://opensource.org/licenses/MIT)
  24. * author: Takuto Wada <takuto.wada@gmail.com>
  25. * contributors: azu, Yosuke Furukawa, Athan, Andrew Moss
  26. * homepage: https://github.com/twada/type-name
  27. * version: 2.0.2
  28. *
  29. * This header is generated by licensify (https://github.com/twada/licensify)
  30. */
  31. (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){
  32. /**
  33. * stringifier
  34. *
  35. * https://github.com/twada/stringifier
  36. *
  37. * Copyright (c) 2014-2018 Takuto Wada
  38. * Licensed under the MIT license.
  39. * https://twada.mit-license.org/2014-2018
  40. */
  41. 'use strict';
  42. var traverse = _dereq_('traverse');
  43. var typeName = _dereq_('type-name');
  44. var assign = _dereq_('core-js/library/fn/object/assign');
  45. var endsWith = _dereq_('core-js/library/fn/string/ends-with');
  46. var s = _dereq_('./strategies');
  47. function defaultHandlers () {
  48. return {
  49. 'null': s.always('null'),
  50. 'undefined': s.always('undefined'),
  51. 'function': s.prune(),
  52. 'string': s.json(),
  53. 'boolean': s.json(),
  54. 'number': s.number(),
  55. 'symbol': s.toStr(),
  56. 'RegExp': s.toStr(),
  57. 'String': s.newLike(),
  58. 'Boolean': s.newLike(),
  59. 'Number': s.newLike(),
  60. 'Date': s.newLike(),
  61. 'Array': s.array(),
  62. 'Object': s.object(),
  63. 'Error': s.object(null, ['message', 'code']),
  64. '@default': s.object()
  65. };
  66. }
  67. function defaultOptions () {
  68. return {
  69. maxDepth: null,
  70. indent: null,
  71. anonymous: '@Anonymous',
  72. circular: '#@Circular#',
  73. snip: '..(snip)',
  74. lineSeparator: '\n',
  75. typeFun: typeName
  76. };
  77. }
  78. function createStringifier (customOptions) {
  79. var options = assign({}, defaultOptions(), customOptions);
  80. var handlers = assign({}, defaultHandlers(), options.handlers);
  81. return function stringifyAny (push, x) {
  82. var context = this;
  83. var handler = handlerFor(context.node, options, handlers);
  84. var currentPath = '/' + context.path.join('/');
  85. var customization = handlers[currentPath];
  86. var acc = {
  87. context: context,
  88. options: options,
  89. handlers: handlers,
  90. push: push
  91. };
  92. if (typeName(customization) === 'function') {
  93. handler = customization;
  94. } else if (typeName(customization) === 'number') {
  95. handler = s.flow.compose(s.filters.truncate(customization),handler);
  96. } else if (context.parent && typeName(context.parent.node) === 'Array' && !(context.key in context.parent.node)) {
  97. // sparse arrays
  98. handler = s.always('');
  99. }
  100. handler(acc, x);
  101. return push;
  102. };
  103. }
  104. function handlerFor (val, options, handlers) {
  105. var tname = options.typeFun(val);
  106. if (typeName(handlers[tname]) === 'function') {
  107. return handlers[tname];
  108. }
  109. if (endsWith(tname, 'Error')) {
  110. return handlers['Error'];
  111. }
  112. return handlers['@default'];
  113. }
  114. function walk (val, reducer) {
  115. var buffer = [];
  116. var push = function (str) {
  117. buffer.push(str);
  118. };
  119. traverse(val).reduce(reducer, push);
  120. return buffer.join('');
  121. }
  122. function stringify (val, options) {
  123. return walk(val, createStringifier(options));
  124. }
  125. function stringifier (options) {
  126. return function (val) {
  127. return walk(val, createStringifier(options));
  128. };
  129. }
  130. stringifier.stringify = stringify;
  131. stringifier.strategies = s;
  132. stringifier.defaultOptions = defaultOptions;
  133. stringifier.defaultHandlers = defaultHandlers;
  134. module.exports = stringifier;
  135. },{"./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){
  136. _dereq_('../../modules/es6.array.filter');
  137. module.exports = _dereq_('../../modules/_core').Array.filter;
  138. },{"../../modules/_core":16,"../../modules/es6.array.filter":53}],3:[function(_dereq_,module,exports){
  139. _dereq_('../../modules/es6.array.for-each');
  140. module.exports = _dereq_('../../modules/_core').Array.forEach;
  141. },{"../../modules/_core":16,"../../modules/es6.array.for-each":54}],4:[function(_dereq_,module,exports){
  142. _dereq_('../../modules/es6.array.index-of');
  143. module.exports = _dereq_('../../modules/_core').Array.indexOf;
  144. },{"../../modules/_core":16,"../../modules/es6.array.index-of":55}],5:[function(_dereq_,module,exports){
  145. _dereq_('../../modules/es6.array.reduce-right');
  146. module.exports = _dereq_('../../modules/_core').Array.reduceRight;
  147. },{"../../modules/_core":16,"../../modules/es6.array.reduce-right":56}],6:[function(_dereq_,module,exports){
  148. _dereq_('../../modules/es6.object.assign');
  149. module.exports = _dereq_('../../modules/_core').Object.assign;
  150. },{"../../modules/_core":16,"../../modules/es6.object.assign":57}],7:[function(_dereq_,module,exports){
  151. _dereq_('../../modules/es6.string.ends-with');
  152. module.exports = _dereq_('../../modules/_core').String.endsWith;
  153. },{"../../modules/_core":16,"../../modules/es6.string.ends-with":58}],8:[function(_dereq_,module,exports){
  154. module.exports = function (it) {
  155. if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  156. return it;
  157. };
  158. },{}],9:[function(_dereq_,module,exports){
  159. var isObject = _dereq_('./_is-object');
  160. module.exports = function (it) {
  161. if (!isObject(it)) throw TypeError(it + ' is not an object!');
  162. return it;
  163. };
  164. },{"./_is-object":31}],10:[function(_dereq_,module,exports){
  165. // false -> Array#indexOf
  166. // true -> Array#includes
  167. var toIObject = _dereq_('./_to-iobject');
  168. var toLength = _dereq_('./_to-length');
  169. var toAbsoluteIndex = _dereq_('./_to-absolute-index');
  170. module.exports = function (IS_INCLUDES) {
  171. return function ($this, el, fromIndex) {
  172. var O = toIObject($this);
  173. var length = toLength(O.length);
  174. var index = toAbsoluteIndex(fromIndex, length);
  175. var value;
  176. // Array#includes uses SameValueZero equality algorithm
  177. // eslint-disable-next-line no-self-compare
  178. if (IS_INCLUDES && el != el) while (length > index) {
  179. value = O[index++];
  180. // eslint-disable-next-line no-self-compare
  181. if (value != value) return true;
  182. // Array#indexOf ignores holes, Array#includes - not
  183. } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
  184. if (O[index] === el) return IS_INCLUDES || index || 0;
  185. } return !IS_INCLUDES && -1;
  186. };
  187. };
  188. },{"./_to-absolute-index":45,"./_to-iobject":47,"./_to-length":48}],11:[function(_dereq_,module,exports){
  189. // 0 -> Array#forEach
  190. // 1 -> Array#map
  191. // 2 -> Array#filter
  192. // 3 -> Array#some
  193. // 4 -> Array#every
  194. // 5 -> Array#find
  195. // 6 -> Array#findIndex
  196. var ctx = _dereq_('./_ctx');
  197. var IObject = _dereq_('./_iobject');
  198. var toObject = _dereq_('./_to-object');
  199. var toLength = _dereq_('./_to-length');
  200. var asc = _dereq_('./_array-species-create');
  201. module.exports = function (TYPE, $create) {
  202. var IS_MAP = TYPE == 1;
  203. var IS_FILTER = TYPE == 2;
  204. var IS_SOME = TYPE == 3;
  205. var IS_EVERY = TYPE == 4;
  206. var IS_FIND_INDEX = TYPE == 6;
  207. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  208. var create = $create || asc;
  209. return function ($this, callbackfn, that) {
  210. var O = toObject($this);
  211. var self = IObject(O);
  212. var f = ctx(callbackfn, that, 3);
  213. var length = toLength(self.length);
  214. var index = 0;
  215. var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  216. var val, res;
  217. for (;length > index; index++) if (NO_HOLES || index in self) {
  218. val = self[index];
  219. res = f(val, index, O);
  220. if (TYPE) {
  221. if (IS_MAP) result[index] = res; // map
  222. else if (res) switch (TYPE) {
  223. case 3: return true; // some
  224. case 5: return val; // find
  225. case 6: return index; // findIndex
  226. case 2: result.push(val); // filter
  227. } else if (IS_EVERY) return false; // every
  228. }
  229. }
  230. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
  231. };
  232. };
  233. },{"./_array-species-create":14,"./_ctx":17,"./_iobject":29,"./_to-length":48,"./_to-object":49}],12:[function(_dereq_,module,exports){
  234. var aFunction = _dereq_('./_a-function');
  235. var toObject = _dereq_('./_to-object');
  236. var IObject = _dereq_('./_iobject');
  237. var toLength = _dereq_('./_to-length');
  238. module.exports = function (that, callbackfn, aLen, memo, isRight) {
  239. aFunction(callbackfn);
  240. var O = toObject(that);
  241. var self = IObject(O);
  242. var length = toLength(O.length);
  243. var index = isRight ? length - 1 : 0;
  244. var i = isRight ? -1 : 1;
  245. if (aLen < 2) for (;;) {
  246. if (index in self) {
  247. memo = self[index];
  248. index += i;
  249. break;
  250. }
  251. index += i;
  252. if (isRight ? index < 0 : length <= index) {
  253. throw TypeError('Reduce of empty array with no initial value');
  254. }
  255. }
  256. for (;isRight ? index >= 0 : length > index; index += i) if (index in self) {
  257. memo = callbackfn(memo, self[index], index, O);
  258. }
  259. return memo;
  260. };
  261. },{"./_a-function":8,"./_iobject":29,"./_to-length":48,"./_to-object":49}],13:[function(_dereq_,module,exports){
  262. var isObject = _dereq_('./_is-object');
  263. var isArray = _dereq_('./_is-array');
  264. var SPECIES = _dereq_('./_wks')('species');
  265. module.exports = function (original) {
  266. var C;
  267. if (isArray(original)) {
  268. C = original.constructor;
  269. // cross-realm fallback
  270. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  271. if (isObject(C)) {
  272. C = C[SPECIES];
  273. if (C === null) C = undefined;
  274. }
  275. } return C === undefined ? Array : C;
  276. };
  277. },{"./_is-array":30,"./_is-object":31,"./_wks":52}],14:[function(_dereq_,module,exports){
  278. // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
  279. var speciesConstructor = _dereq_('./_array-species-constructor');
  280. module.exports = function (original, length) {
  281. return new (speciesConstructor(original))(length);
  282. };
  283. },{"./_array-species-constructor":13}],15:[function(_dereq_,module,exports){
  284. var toString = {}.toString;
  285. module.exports = function (it) {
  286. return toString.call(it).slice(8, -1);
  287. };
  288. },{}],16:[function(_dereq_,module,exports){
  289. var core = module.exports = { version: '2.5.7' };
  290. if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
  291. },{}],17:[function(_dereq_,module,exports){
  292. // optional / simple context binding
  293. var aFunction = _dereq_('./_a-function');
  294. module.exports = function (fn, that, length) {
  295. aFunction(fn);
  296. if (that === undefined) return fn;
  297. switch (length) {
  298. case 1: return function (a) {
  299. return fn.call(that, a);
  300. };
  301. case 2: return function (a, b) {
  302. return fn.call(that, a, b);
  303. };
  304. case 3: return function (a, b, c) {
  305. return fn.call(that, a, b, c);
  306. };
  307. }
  308. return function (/* ...args */) {
  309. return fn.apply(that, arguments);
  310. };
  311. };
  312. },{"./_a-function":8}],18:[function(_dereq_,module,exports){
  313. // 7.2.1 RequireObjectCoercible(argument)
  314. module.exports = function (it) {
  315. if (it == undefined) throw TypeError("Can't call method on " + it);
  316. return it;
  317. };
  318. },{}],19:[function(_dereq_,module,exports){
  319. // Thank's IE8 for his funny defineProperty
  320. module.exports = !_dereq_('./_fails')(function () {
  321. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  322. });
  323. },{"./_fails":24}],20:[function(_dereq_,module,exports){
  324. var isObject = _dereq_('./_is-object');
  325. var document = _dereq_('./_global').document;
  326. // typeof document.createElement is 'object' in old IE
  327. var is = isObject(document) && isObject(document.createElement);
  328. module.exports = function (it) {
  329. return is ? document.createElement(it) : {};
  330. };
  331. },{"./_global":25,"./_is-object":31}],21:[function(_dereq_,module,exports){
  332. // IE 8- don't enum bug keys
  333. module.exports = (
  334. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  335. ).split(',');
  336. },{}],22:[function(_dereq_,module,exports){
  337. var global = _dereq_('./_global');
  338. var core = _dereq_('./_core');
  339. var ctx = _dereq_('./_ctx');
  340. var hide = _dereq_('./_hide');
  341. var has = _dereq_('./_has');
  342. var PROTOTYPE = 'prototype';
  343. var $export = function (type, name, source) {
  344. var IS_FORCED = type & $export.F;
  345. var IS_GLOBAL = type & $export.G;
  346. var IS_STATIC = type & $export.S;
  347. var IS_PROTO = type & $export.P;
  348. var IS_BIND = type & $export.B;
  349. var IS_WRAP = type & $export.W;
  350. var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
  351. var expProto = exports[PROTOTYPE];
  352. var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
  353. var key, own, out;
  354. if (IS_GLOBAL) source = name;
  355. for (key in source) {
  356. // contains in native
  357. own = !IS_FORCED && target && target[key] !== undefined;
  358. if (own && has(exports, key)) continue;
  359. // export native or passed
  360. out = own ? target[key] : source[key];
  361. // prevent global pollution for namespaces
  362. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  363. // bind timers to global for call from export context
  364. : IS_BIND && own ? ctx(out, global)
  365. // wrap global constructors for prevent change them in library
  366. : IS_WRAP && target[key] == out ? (function (C) {
  367. var F = function (a, b, c) {
  368. if (this instanceof C) {
  369. switch (arguments.length) {
  370. case 0: return new C();
  371. case 1: return new C(a);
  372. case 2: return new C(a, b);
  373. } return new C(a, b, c);
  374. } return C.apply(this, arguments);
  375. };
  376. F[PROTOTYPE] = C[PROTOTYPE];
  377. return F;
  378. // make static versions for prototype methods
  379. })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
  380. // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
  381. if (IS_PROTO) {
  382. (exports.virtual || (exports.virtual = {}))[key] = out;
  383. // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
  384. if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
  385. }
  386. }
  387. };
  388. // type bitmap
  389. $export.F = 1; // forced
  390. $export.G = 2; // global
  391. $export.S = 4; // static
  392. $export.P = 8; // proto
  393. $export.B = 16; // bind
  394. $export.W = 32; // wrap
  395. $export.U = 64; // safe
  396. $export.R = 128; // real proto method for `library`
  397. module.exports = $export;
  398. },{"./_core":16,"./_ctx":17,"./_global":25,"./_has":26,"./_hide":27}],23:[function(_dereq_,module,exports){
  399. var MATCH = _dereq_('./_wks')('match');
  400. module.exports = function (KEY) {
  401. var re = /./;
  402. try {
  403. '/./'[KEY](re);
  404. } catch (e) {
  405. try {
  406. re[MATCH] = false;
  407. return !'/./'[KEY](re);
  408. } catch (f) { /* empty */ }
  409. } return true;
  410. };
  411. },{"./_wks":52}],24:[function(_dereq_,module,exports){
  412. module.exports = function (exec) {
  413. try {
  414. return !!exec();
  415. } catch (e) {
  416. return true;
  417. }
  418. };
  419. },{}],25:[function(_dereq_,module,exports){
  420. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  421. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  422. ? window : typeof self != 'undefined' && self.Math == Math ? self
  423. // eslint-disable-next-line no-new-func
  424. : Function('return this')();
  425. if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
  426. },{}],26:[function(_dereq_,module,exports){
  427. var hasOwnProperty = {}.hasOwnProperty;
  428. module.exports = function (it, key) {
  429. return hasOwnProperty.call(it, key);
  430. };
  431. },{}],27:[function(_dereq_,module,exports){
  432. var dP = _dereq_('./_object-dp');
  433. var createDesc = _dereq_('./_property-desc');
  434. module.exports = _dereq_('./_descriptors') ? function (object, key, value) {
  435. return dP.f(object, key, createDesc(1, value));
  436. } : function (object, key, value) {
  437. object[key] = value;
  438. return object;
  439. };
  440. },{"./_descriptors":19,"./_object-dp":35,"./_property-desc":40}],28:[function(_dereq_,module,exports){
  441. module.exports = !_dereq_('./_descriptors') && !_dereq_('./_fails')(function () {
  442. return Object.defineProperty(_dereq_('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;
  443. });
  444. },{"./_descriptors":19,"./_dom-create":20,"./_fails":24}],29:[function(_dereq_,module,exports){
  445. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  446. var cof = _dereq_('./_cof');
  447. // eslint-disable-next-line no-prototype-builtins
  448. module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  449. return cof(it) == 'String' ? it.split('') : Object(it);
  450. };
  451. },{"./_cof":15}],30:[function(_dereq_,module,exports){
  452. // 7.2.2 IsArray(argument)
  453. var cof = _dereq_('./_cof');
  454. module.exports = Array.isArray || function isArray(arg) {
  455. return cof(arg) == 'Array';
  456. };
  457. },{"./_cof":15}],31:[function(_dereq_,module,exports){
  458. module.exports = function (it) {
  459. return typeof it === 'object' ? it !== null : typeof it === 'function';
  460. };
  461. },{}],32:[function(_dereq_,module,exports){
  462. // 7.2.8 IsRegExp(argument)
  463. var isObject = _dereq_('./_is-object');
  464. var cof = _dereq_('./_cof');
  465. var MATCH = _dereq_('./_wks')('match');
  466. module.exports = function (it) {
  467. var isRegExp;
  468. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
  469. };
  470. },{"./_cof":15,"./_is-object":31,"./_wks":52}],33:[function(_dereq_,module,exports){
  471. module.exports = true;
  472. },{}],34:[function(_dereq_,module,exports){
  473. 'use strict';
  474. // 19.1.2.1 Object.assign(target, source, ...)
  475. var getKeys = _dereq_('./_object-keys');
  476. var gOPS = _dereq_('./_object-gops');
  477. var pIE = _dereq_('./_object-pie');
  478. var toObject = _dereq_('./_to-object');
  479. var IObject = _dereq_('./_iobject');
  480. var $assign = Object.assign;
  481. // should work with symbols and should have deterministic property order (V8 bug)
  482. module.exports = !$assign || _dereq_('./_fails')(function () {
  483. var A = {};
  484. var B = {};
  485. // eslint-disable-next-line no-undef
  486. var S = Symbol();
  487. var K = 'abcdefghijklmnopqrst';
  488. A[S] = 7;
  489. K.split('').forEach(function (k) { B[k] = k; });
  490. return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
  491. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
  492. var T = toObject(target);
  493. var aLen = arguments.length;
  494. var index = 1;
  495. var getSymbols = gOPS.f;
  496. var isEnum = pIE.f;
  497. while (aLen > index) {
  498. var S = IObject(arguments[index++]);
  499. var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
  500. var length = keys.length;
  501. var j = 0;
  502. var key;
  503. while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
  504. } return T;
  505. } : $assign;
  506. },{"./_fails":24,"./_iobject":29,"./_object-gops":36,"./_object-keys":38,"./_object-pie":39,"./_to-object":49}],35:[function(_dereq_,module,exports){
  507. var anObject = _dereq_('./_an-object');
  508. var IE8_DOM_DEFINE = _dereq_('./_ie8-dom-define');
  509. var toPrimitive = _dereq_('./_to-primitive');
  510. var dP = Object.defineProperty;
  511. exports.f = _dereq_('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  512. anObject(O);
  513. P = toPrimitive(P, true);
  514. anObject(Attributes);
  515. if (IE8_DOM_DEFINE) try {
  516. return dP(O, P, Attributes);
  517. } catch (e) { /* empty */ }
  518. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  519. if ('value' in Attributes) O[P] = Attributes.value;
  520. return O;
  521. };
  522. },{"./_an-object":9,"./_descriptors":19,"./_ie8-dom-define":28,"./_to-primitive":50}],36:[function(_dereq_,module,exports){
  523. exports.f = Object.getOwnPropertySymbols;
  524. },{}],37:[function(_dereq_,module,exports){
  525. var has = _dereq_('./_has');
  526. var toIObject = _dereq_('./_to-iobject');
  527. var arrayIndexOf = _dereq_('./_array-includes')(false);
  528. var IE_PROTO = _dereq_('./_shared-key')('IE_PROTO');
  529. module.exports = function (object, names) {
  530. var O = toIObject(object);
  531. var i = 0;
  532. var result = [];
  533. var key;
  534. for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
  535. // Don't enum bug & hidden keys
  536. while (names.length > i) if (has(O, key = names[i++])) {
  537. ~arrayIndexOf(result, key) || result.push(key);
  538. }
  539. return result;
  540. };
  541. },{"./_array-includes":10,"./_has":26,"./_shared-key":41,"./_to-iobject":47}],38:[function(_dereq_,module,exports){
  542. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  543. var $keys = _dereq_('./_object-keys-internal');
  544. var enumBugKeys = _dereq_('./_enum-bug-keys');
  545. module.exports = Object.keys || function keys(O) {
  546. return $keys(O, enumBugKeys);
  547. };
  548. },{"./_enum-bug-keys":21,"./_object-keys-internal":37}],39:[function(_dereq_,module,exports){
  549. exports.f = {}.propertyIsEnumerable;
  550. },{}],40:[function(_dereq_,module,exports){
  551. module.exports = function (bitmap, value) {
  552. return {
  553. enumerable: !(bitmap & 1),
  554. configurable: !(bitmap & 2),
  555. writable: !(bitmap & 4),
  556. value: value
  557. };
  558. };
  559. },{}],41:[function(_dereq_,module,exports){
  560. var shared = _dereq_('./_shared')('keys');
  561. var uid = _dereq_('./_uid');
  562. module.exports = function (key) {
  563. return shared[key] || (shared[key] = uid(key));
  564. };
  565. },{"./_shared":42,"./_uid":51}],42:[function(_dereq_,module,exports){
  566. var core = _dereq_('./_core');
  567. var global = _dereq_('./_global');
  568. var SHARED = '__core-js_shared__';
  569. var store = global[SHARED] || (global[SHARED] = {});
  570. (module.exports = function (key, value) {
  571. return store[key] || (store[key] = value !== undefined ? value : {});
  572. })('versions', []).push({
  573. version: core.version,
  574. mode: _dereq_('./_library') ? 'pure' : 'global',
  575. copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
  576. });
  577. },{"./_core":16,"./_global":25,"./_library":33}],43:[function(_dereq_,module,exports){
  578. 'use strict';
  579. var fails = _dereq_('./_fails');
  580. module.exports = function (method, arg) {
  581. return !!method && fails(function () {
  582. // eslint-disable-next-line no-useless-call
  583. arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);
  584. });
  585. };
  586. },{"./_fails":24}],44:[function(_dereq_,module,exports){
  587. // helper for String#{startsWith, endsWith, includes}
  588. var isRegExp = _dereq_('./_is-regexp');
  589. var defined = _dereq_('./_defined');
  590. module.exports = function (that, searchString, NAME) {
  591. if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!");
  592. return String(defined(that));
  593. };
  594. },{"./_defined":18,"./_is-regexp":32}],45:[function(_dereq_,module,exports){
  595. var toInteger = _dereq_('./_to-integer');
  596. var max = Math.max;
  597. var min = Math.min;
  598. module.exports = function (index, length) {
  599. index = toInteger(index);
  600. return index < 0 ? max(index + length, 0) : min(index, length);
  601. };
  602. },{"./_to-integer":46}],46:[function(_dereq_,module,exports){
  603. // 7.1.4 ToInteger
  604. var ceil = Math.ceil;
  605. var floor = Math.floor;
  606. module.exports = function (it) {
  607. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  608. };
  609. },{}],47:[function(_dereq_,module,exports){
  610. // to indexed object, toObject with fallback for non-array-like ES3 strings
  611. var IObject = _dereq_('./_iobject');
  612. var defined = _dereq_('./_defined');
  613. module.exports = function (it) {
  614. return IObject(defined(it));
  615. };
  616. },{"./_defined":18,"./_iobject":29}],48:[function(_dereq_,module,exports){
  617. // 7.1.15 ToLength
  618. var toInteger = _dereq_('./_to-integer');
  619. var min = Math.min;
  620. module.exports = function (it) {
  621. return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  622. };
  623. },{"./_to-integer":46}],49:[function(_dereq_,module,exports){
  624. // 7.1.13 ToObject(argument)
  625. var defined = _dereq_('./_defined');
  626. module.exports = function (it) {
  627. return Object(defined(it));
  628. };
  629. },{"./_defined":18}],50:[function(_dereq_,module,exports){
  630. // 7.1.1 ToPrimitive(input [, PreferredType])
  631. var isObject = _dereq_('./_is-object');
  632. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  633. // and the second argument - flag - preferred type is a string
  634. module.exports = function (it, S) {
  635. if (!isObject(it)) return it;
  636. var fn, val;
  637. if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  638. if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
  639. if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  640. throw TypeError("Can't convert object to primitive value");
  641. };
  642. },{"./_is-object":31}],51:[function(_dereq_,module,exports){
  643. var id = 0;
  644. var px = Math.random();
  645. module.exports = function (key) {
  646. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  647. };
  648. },{}],52:[function(_dereq_,module,exports){
  649. var store = _dereq_('./_shared')('wks');
  650. var uid = _dereq_('./_uid');
  651. var Symbol = _dereq_('./_global').Symbol;
  652. var USE_SYMBOL = typeof Symbol == 'function';
  653. var $exports = module.exports = function (name) {
  654. return store[name] || (store[name] =
  655. USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
  656. };
  657. $exports.store = store;
  658. },{"./_global":25,"./_shared":42,"./_uid":51}],53:[function(_dereq_,module,exports){
  659. 'use strict';
  660. var $export = _dereq_('./_export');
  661. var $filter = _dereq_('./_array-methods')(2);
  662. $export($export.P + $export.F * !_dereq_('./_strict-method')([].filter, true), 'Array', {
  663. // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
  664. filter: function filter(callbackfn /* , thisArg */) {
  665. return $filter(this, callbackfn, arguments[1]);
  666. }
  667. });
  668. },{"./_array-methods":11,"./_export":22,"./_strict-method":43}],54:[function(_dereq_,module,exports){
  669. 'use strict';
  670. var $export = _dereq_('./_export');
  671. var $forEach = _dereq_('./_array-methods')(0);
  672. var STRICT = _dereq_('./_strict-method')([].forEach, true);
  673. $export($export.P + $export.F * !STRICT, 'Array', {
  674. // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
  675. forEach: function forEach(callbackfn /* , thisArg */) {
  676. return $forEach(this, callbackfn, arguments[1]);
  677. }
  678. });
  679. },{"./_array-methods":11,"./_export":22,"./_strict-method":43}],55:[function(_dereq_,module,exports){
  680. 'use strict';
  681. var $export = _dereq_('./_export');
  682. var $indexOf = _dereq_('./_array-includes')(false);
  683. var $native = [].indexOf;
  684. var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;
  685. $export($export.P + $export.F * (NEGATIVE_ZERO || !_dereq_('./_strict-method')($native)), 'Array', {
  686. // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
  687. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  688. return NEGATIVE_ZERO
  689. // convert -0 to +0
  690. ? $native.apply(this, arguments) || 0
  691. : $indexOf(this, searchElement, arguments[1]);
  692. }
  693. });
  694. },{"./_array-includes":10,"./_export":22,"./_strict-method":43}],56:[function(_dereq_,module,exports){
  695. 'use strict';
  696. var $export = _dereq_('./_export');
  697. var $reduce = _dereq_('./_array-reduce');
  698. $export($export.P + $export.F * !_dereq_('./_strict-method')([].reduceRight, true), 'Array', {
  699. // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
  700. reduceRight: function reduceRight(callbackfn /* , initialValue */) {
  701. return $reduce(this, callbackfn, arguments.length, arguments[1], true);
  702. }
  703. });
  704. },{"./_array-reduce":12,"./_export":22,"./_strict-method":43}],57:[function(_dereq_,module,exports){
  705. // 19.1.3.1 Object.assign(target, source)
  706. var $export = _dereq_('./_export');
  707. $export($export.S + $export.F, 'Object', { assign: _dereq_('./_object-assign') });
  708. },{"./_export":22,"./_object-assign":34}],58:[function(_dereq_,module,exports){
  709. // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
  710. 'use strict';
  711. var $export = _dereq_('./_export');
  712. var toLength = _dereq_('./_to-length');
  713. var context = _dereq_('./_string-context');
  714. var ENDS_WITH = 'endsWith';
  715. var $endsWith = ''[ENDS_WITH];
  716. $export($export.P + $export.F * _dereq_('./_fails-is-regexp')(ENDS_WITH), 'String', {
  717. endsWith: function endsWith(searchString /* , endPosition = @length */) {
  718. var that = context(this, searchString, ENDS_WITH);
  719. var endPosition = arguments.length > 1 ? arguments[1] : undefined;
  720. var len = toLength(that.length);
  721. var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len);
  722. var search = String(searchString);
  723. return $endsWith
  724. ? $endsWith.call(that, search, end)
  725. : that.slice(end - search.length, end) === search;
  726. }
  727. });
  728. },{"./_export":22,"./_fails-is-regexp":23,"./_string-context":44,"./_to-length":48}],59:[function(_dereq_,module,exports){
  729. var traverse = module.exports = function (obj) {
  730. return new Traverse(obj);
  731. };
  732. function Traverse (obj) {
  733. this.value = obj;
  734. }
  735. Traverse.prototype.get = function (ps) {
  736. var node = this.value;
  737. for (var i = 0; i < ps.length; i ++) {
  738. var key = ps[i];
  739. if (!node || !hasOwnProperty.call(node, key)) {
  740. node = undefined;
  741. break;
  742. }
  743. node = node[key];
  744. }
  745. return node;
  746. };
  747. Traverse.prototype.has = function (ps) {
  748. var node = this.value;
  749. for (var i = 0; i < ps.length; i ++) {
  750. var key = ps[i];
  751. if (!node || !hasOwnProperty.call(node, key)) {
  752. return false;
  753. }
  754. node = node[key];
  755. }
  756. return true;
  757. };
  758. Traverse.prototype.set = function (ps, value) {
  759. var node = this.value;
  760. for (var i = 0; i < ps.length - 1; i ++) {
  761. var key = ps[i];
  762. if (!hasOwnProperty.call(node, key)) node[key] = {};
  763. node = node[key];
  764. }
  765. node[ps[i]] = value;
  766. return value;
  767. };
  768. Traverse.prototype.map = function (cb) {
  769. return walk(this.value, cb, true);
  770. };
  771. Traverse.prototype.forEach = function (cb) {
  772. this.value = walk(this.value, cb, false);
  773. return this.value;
  774. };
  775. Traverse.prototype.reduce = function (cb, init) {
  776. var skip = arguments.length === 1;
  777. var acc = skip ? this.value : init;
  778. this.forEach(function (x) {
  779. if (!this.isRoot || !skip) {
  780. acc = cb.call(this, acc, x);
  781. }
  782. });
  783. return acc;
  784. };
  785. Traverse.prototype.paths = function () {
  786. var acc = [];
  787. this.forEach(function (x) {
  788. acc.push(this.path);
  789. });
  790. return acc;
  791. };
  792. Traverse.prototype.nodes = function () {
  793. var acc = [];
  794. this.forEach(function (x) {
  795. acc.push(this.node);
  796. });
  797. return acc;
  798. };
  799. Traverse.prototype.clone = function () {
  800. var parents = [], nodes = [];
  801. return (function clone (src) {
  802. for (var i = 0; i < parents.length; i++) {
  803. if (parents[i] === src) {
  804. return nodes[i];
  805. }
  806. }
  807. if (typeof src === 'object' && src !== null) {
  808. var dst = copy(src);
  809. parents.push(src);
  810. nodes.push(dst);
  811. forEach(objectKeys(src), function (key) {
  812. dst[key] = clone(src[key]);
  813. });
  814. parents.pop();
  815. nodes.pop();
  816. return dst;
  817. }
  818. else {
  819. return src;
  820. }
  821. })(this.value);
  822. };
  823. function walk (root, cb, immutable) {
  824. var path = [];
  825. var parents = [];
  826. var alive = true;
  827. return (function walker (node_) {
  828. var node = immutable ? copy(node_) : node_;
  829. var modifiers = {};
  830. var keepGoing = true;
  831. var state = {
  832. node : node,
  833. node_ : node_,
  834. path : [].concat(path),
  835. parent : parents[parents.length - 1],
  836. parents : parents,
  837. key : path.slice(-1)[0],
  838. isRoot : path.length === 0,
  839. level : path.length,
  840. circular : null,
  841. update : function (x, stopHere) {
  842. if (!state.isRoot) {
  843. state.parent.node[state.key] = x;
  844. }
  845. state.node = x;
  846. if (stopHere) keepGoing = false;
  847. },
  848. 'delete' : function (stopHere) {
  849. delete state.parent.node[state.key];
  850. if (stopHere) keepGoing = false;
  851. },
  852. remove : function (stopHere) {
  853. if (isArray(state.parent.node)) {
  854. state.parent.node.splice(state.key, 1);
  855. }
  856. else {
  857. delete state.parent.node[state.key];
  858. }
  859. if (stopHere) keepGoing = false;
  860. },
  861. keys : null,
  862. before : function (f) { modifiers.before = f },
  863. after : function (f) { modifiers.after = f },
  864. pre : function (f) { modifiers.pre = f },
  865. post : function (f) { modifiers.post = f },
  866. stop : function () { alive = false },
  867. block : function () { keepGoing = false }
  868. };
  869. if (!alive) return state;
  870. function updateState() {
  871. if (typeof state.node === 'object' && state.node !== null) {
  872. if (!state.keys || state.node_ !== state.node) {
  873. state.keys = objectKeys(state.node)
  874. }
  875. state.isLeaf = state.keys.length == 0;
  876. for (var i = 0; i < parents.length; i++) {
  877. if (parents[i].node_ === node_) {
  878. state.circular = parents[i];
  879. break;
  880. }
  881. }
  882. }
  883. else {
  884. state.isLeaf = true;
  885. state.keys = null;
  886. }
  887. state.notLeaf = !state.isLeaf;
  888. state.notRoot = !state.isRoot;
  889. }
  890. updateState();
  891. // use return values to update if defined
  892. var ret = cb.call(state, state.node);
  893. if (ret !== undefined && state.update) state.update(ret);
  894. if (modifiers.before) modifiers.before.call(state, state.node);
  895. if (!keepGoing) return state;
  896. if (typeof state.node == 'object'
  897. && state.node !== null && !state.circular) {
  898. parents.push(state);
  899. updateState();
  900. forEach(state.keys, function (key, i) {
  901. path.push(key);
  902. if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);
  903. var child = walker(state.node[key]);
  904. if (immutable && hasOwnProperty.call(state.node, key)) {
  905. state.node[key] = child.node;
  906. }
  907. child.isLast = i == state.keys.length - 1;
  908. child.isFirst = i == 0;
  909. if (modifiers.post) modifiers.post.call(state, child);
  910. path.pop();
  911. });
  912. parents.pop();
  913. }
  914. if (modifiers.after) modifiers.after.call(state, state.node);
  915. return state;
  916. })(root).node;
  917. }
  918. function copy (src) {
  919. if (typeof src === 'object' && src !== null) {
  920. var dst;
  921. if (isArray(src)) {
  922. dst = [];
  923. }
  924. else if (isDate(src)) {
  925. dst = new Date(src.getTime ? src.getTime() : src);
  926. }
  927. else if (isRegExp(src)) {
  928. dst = new RegExp(src);
  929. }
  930. else if (isError(src)) {
  931. dst = { message: src.message };
  932. }
  933. else if (isBoolean(src)) {
  934. dst = new Boolean(src);
  935. }
  936. else if (isNumber(src)) {
  937. dst = new Number(src);
  938. }
  939. else if (isString(src)) {
  940. dst = new String(src);
  941. }
  942. else if (Object.create && Object.getPrototypeOf) {
  943. dst = Object.create(Object.getPrototypeOf(src));
  944. }
  945. else if (src.constructor === Object) {
  946. dst = {};
  947. }
  948. else {
  949. var proto =
  950. (src.constructor && src.constructor.prototype)
  951. || src.__proto__
  952. || {}
  953. ;
  954. var T = function () {};
  955. T.prototype = proto;
  956. dst = new T;
  957. }
  958. forEach(objectKeys(src), function (key) {
  959. dst[key] = src[key];
  960. });
  961. return dst;
  962. }
  963. else return src;
  964. }
  965. var objectKeys = Object.keys || function keys (obj) {
  966. var res = [];
  967. for (var key in obj) res.push(key)
  968. return res;
  969. };
  970. function toS (obj) { return Object.prototype.toString.call(obj) }
  971. function isDate (obj) { return toS(obj) === '[object Date]' }
  972. function isRegExp (obj) { return toS(obj) === '[object RegExp]' }
  973. function isError (obj) { return toS(obj) === '[object Error]' }
  974. function isBoolean (obj) { return toS(obj) === '[object Boolean]' }
  975. function isNumber (obj) { return toS(obj) === '[object Number]' }
  976. function isString (obj) { return toS(obj) === '[object String]' }
  977. var isArray = Array.isArray || function isArray (xs) {
  978. return Object.prototype.toString.call(xs) === '[object Array]';
  979. };
  980. var forEach = function (xs, fn) {
  981. if (xs.forEach) return xs.forEach(fn)
  982. else for (var i = 0; i < xs.length; i++) {
  983. fn(xs[i], i, xs);
  984. }
  985. };
  986. forEach(objectKeys(Traverse.prototype), function (key) {
  987. traverse[key] = function (obj) {
  988. var args = [].slice.call(arguments, 1);
  989. var t = new Traverse(obj);
  990. return t[key].apply(t, args);
  991. };
  992. });
  993. var hasOwnProperty = Object.hasOwnProperty || function (obj, key) {
  994. return key in obj;
  995. };
  996. },{}],60:[function(_dereq_,module,exports){
  997. /**
  998. * type-name - Just a reasonable typeof
  999. *
  1000. * https://github.com/twada/type-name
  1001. *
  1002. * Copyright (c) 2014-2016 Takuto Wada
  1003. * Licensed under the MIT license.
  1004. * https://github.com/twada/type-name/blob/master/LICENSE
  1005. */
  1006. 'use strict';
  1007. var toStr = Object.prototype.toString;
  1008. function funcName (f) {
  1009. if (f.name) {
  1010. return f.name;
  1011. }
  1012. var match = /^\s*function\s*([^\(]*)/im.exec(f.toString());
  1013. return match ? match[1] : '';
  1014. }
  1015. function ctorName (obj) {
  1016. var strName = toStr.call(obj).slice(8, -1);
  1017. if ((strName === 'Object' || strName === 'Error') && obj.constructor) {
  1018. return funcName(obj.constructor);
  1019. }
  1020. return strName;
  1021. }
  1022. function typeName (val) {
  1023. var type;
  1024. if (val === null) {
  1025. return 'null';
  1026. }
  1027. type = typeof val;
  1028. if (type === 'object') {
  1029. return ctorName(val);
  1030. }
  1031. return type;
  1032. }
  1033. module.exports = typeName;
  1034. },{}],61:[function(_dereq_,module,exports){
  1035. 'use strict';
  1036. var typeName = _dereq_('type-name');
  1037. var forEach = _dereq_('core-js/library/fn/array/for-each');
  1038. var arrayFilter = _dereq_('core-js/library/fn/array/filter');
  1039. var reduceRight = _dereq_('core-js/library/fn/array/reduce-right');
  1040. var indexOf = _dereq_('core-js/library/fn/array/index-of');
  1041. var slice = Array.prototype.slice;
  1042. var END = {};
  1043. var ITERATE = {};
  1044. // arguments should end with end or iterate
  1045. function compose () {
  1046. var filters = slice.apply(arguments);
  1047. return reduceRight(filters, function(right, left) {
  1048. return left(right);
  1049. });
  1050. }
  1051. // skip children
  1052. function end () {
  1053. return function (acc, x) {
  1054. acc.context.keys = [];
  1055. return END;
  1056. };
  1057. }
  1058. // iterate children
  1059. function iterate () {
  1060. return function (acc, x) {
  1061. return ITERATE;
  1062. };
  1063. }
  1064. function filter (predicate) {
  1065. return function (next) {
  1066. return function (acc, x) {
  1067. var toBeIterated;
  1068. var isIteratingArray = (typeName(x) === 'Array');
  1069. if (typeName(predicate) === 'function') {
  1070. toBeIterated = [];
  1071. forEach(acc.context.keys, function (key) {
  1072. var indexOrKey = isIteratingArray ? parseInt(key, 10) : key;
  1073. var kvp = {
  1074. key: indexOrKey,
  1075. value: x[key]
  1076. };
  1077. var decision = predicate(kvp);
  1078. if (decision) {
  1079. toBeIterated.push(key);
  1080. }
  1081. if (typeName(decision) === 'number') {
  1082. truncateByKey(decision, key, acc);
  1083. }
  1084. if (typeName(decision) === 'function') {
  1085. customizeStrategyForKey(decision, key, acc);
  1086. }
  1087. });
  1088. acc.context.keys = toBeIterated;
  1089. }
  1090. return next(acc, x);
  1091. };
  1092. };
  1093. }
  1094. function customizeStrategyForKey (strategy, key, acc) {
  1095. acc.handlers[currentPath(key, acc)] = strategy;
  1096. }
  1097. function truncateByKey (size, key, acc) {
  1098. acc.handlers[currentPath(key, acc)] = size;
  1099. }
  1100. function currentPath (key, acc) {
  1101. var pathToCurrentNode = [''].concat(acc.context.path);
  1102. if (typeName(key) !== 'undefined') {
  1103. pathToCurrentNode.push(key);
  1104. }
  1105. return pathToCurrentNode.join('/');
  1106. }
  1107. function allowedKeys (orderedWhiteList) {
  1108. return function (next) {
  1109. return function (acc, x) {
  1110. var isIteratingArray = (typeName(x) === 'Array');
  1111. if (!isIteratingArray && typeName(orderedWhiteList) === 'Array') {
  1112. acc.context.keys = arrayFilter(orderedWhiteList, function (propKey) {
  1113. return x.hasOwnProperty(propKey);
  1114. });
  1115. }
  1116. return next(acc, x);
  1117. };
  1118. };
  1119. }
  1120. function safeKeys () {
  1121. return function (next) {
  1122. return function (acc, x) {
  1123. if (typeName(x) !== 'Array') {
  1124. acc.context.keys = arrayFilter(acc.context.keys, function (propKey) {
  1125. // Error handling for unsafe property access.
  1126. // For example, on PhantomJS,
  1127. // accessing HTMLInputElement.selectionEnd causes TypeError
  1128. try {
  1129. var val = x[propKey];
  1130. return true;
  1131. } catch (e) {
  1132. // skip unsafe key
  1133. return false;
  1134. }
  1135. });
  1136. }
  1137. return next(acc, x);
  1138. };
  1139. };
  1140. }
  1141. function arrayIndicesToKeys () {
  1142. return function (next) {
  1143. return function (acc, x) {
  1144. if (typeName(x) === 'Array' && 0 < x.length) {
  1145. var indices = Array(x.length);
  1146. for(var i = 0; i < x.length; i += 1) {
  1147. indices[i] = String(i); // traverse uses strings as keys
  1148. }
  1149. acc.context.keys = indices;
  1150. }
  1151. return next(acc, x);
  1152. };
  1153. };
  1154. }
  1155. function when (guard, then) {
  1156. return function (next) {
  1157. return function (acc, x) {
  1158. var kvp = {
  1159. key: acc.context.key,
  1160. value: x
  1161. };
  1162. if (guard(kvp, acc)) {
  1163. return then(acc, x);
  1164. }
  1165. return next(acc, x);
  1166. };
  1167. };
  1168. }
  1169. function truncate (size) {
  1170. return function (next) {
  1171. return function (acc, x) {
  1172. var orig = acc.push;
  1173. var ret;
  1174. acc.push = function (str) {
  1175. var savings = str.length - size;
  1176. var truncated;
  1177. if (savings <= size) {
  1178. orig.call(acc, str);
  1179. } else {
  1180. truncated = str.substring(0, size);
  1181. orig.call(acc, truncated + acc.options.snip);
  1182. }
  1183. };
  1184. ret = next(acc, x);
  1185. acc.push = orig;
  1186. return ret;
  1187. };
  1188. };
  1189. }
  1190. function constructorName () {
  1191. return function (next) {
  1192. return function (acc, x) {
  1193. var name = acc.options.typeFun(x);
  1194. if (name === '') {
  1195. name = acc.options.anonymous;
  1196. }
  1197. acc.push(name);
  1198. return next(acc, x);
  1199. };
  1200. };
  1201. }
  1202. function always (str) {
  1203. return function (next) {
  1204. return function (acc, x) {
  1205. acc.push(str);
  1206. return next(acc, x);
  1207. };
  1208. };
  1209. }
  1210. function optionValue (key) {
  1211. return function (next) {
  1212. return function (acc, x) {
  1213. acc.push(acc.options[key]);
  1214. return next(acc, x);
  1215. };
  1216. };
  1217. }
  1218. function json (replacer) {
  1219. return function (next) {
  1220. return function (acc, x) {
  1221. acc.push(JSON.stringify(x, replacer));
  1222. return next(acc, x);
  1223. };
  1224. };
  1225. }
  1226. function toStr () {
  1227. return function (next) {
  1228. return function (acc, x) {
  1229. acc.push(x.toString());
  1230. return next(acc, x);
  1231. };
  1232. };
  1233. }
  1234. function decorateArray () {
  1235. return function (next) {
  1236. return function (acc, x) {
  1237. acc.context.before(function (node) {
  1238. acc.push('[');
  1239. });
  1240. acc.context.after(function (node) {
  1241. afterAllChildren(this, acc.push, acc.options);
  1242. acc.push(']');
  1243. });
  1244. acc.context.pre(function (val, key) {
  1245. beforeEachChild(this, acc.push, acc.options);
  1246. });
  1247. acc.context.post(function (childContext) {
  1248. afterEachChild(childContext, acc.push);
  1249. });
  1250. return next(acc, x);
  1251. };
  1252. };
  1253. }
  1254. function decorateObject () {
  1255. return function (next) {
  1256. return function (acc, x) {
  1257. acc.context.before(function (node) {
  1258. acc.push('{');
  1259. });
  1260. acc.context.after(function (node) {
  1261. afterAllChildren(this, acc.push, acc.options);
  1262. acc.push('}');
  1263. });
  1264. acc.context.pre(function (val, key) {
  1265. beforeEachChild(this, acc.push, acc.options);
  1266. acc.push(sanitizeKey(key) + (acc.options.indent ? ': ' : ':'));
  1267. });
  1268. acc.context.post(function (childContext) {
  1269. afterEachChild(childContext, acc.push);
  1270. });
  1271. return next(acc, x);
  1272. };
  1273. };
  1274. }
  1275. function sanitizeKey (key) {
  1276. return /^[A-Za-z_]+$/.test(key) ? key : JSON.stringify(key);
  1277. }
  1278. function afterAllChildren (context, push, options) {
  1279. if (options.indent && 0 < context.keys.length) {
  1280. push(options.lineSeparator);
  1281. for(var i = 0; i < context.level; i += 1) { // indent level - 1
  1282. push(options.indent);
  1283. }
  1284. }
  1285. }
  1286. function beforeEachChild (context, push, options) {
  1287. if (options.indent) {
  1288. push(options.lineSeparator);
  1289. for(var i = 0; i <= context.level; i += 1) {
  1290. push(options.indent);
  1291. }
  1292. }
  1293. }
  1294. function afterEachChild (childContext, push) {
  1295. if (!childContext.isLast) {
  1296. push(',');
  1297. }
  1298. }
  1299. function nan (kvp, acc) {
  1300. return kvp.value !== kvp.value;
  1301. }
  1302. function positiveInfinity (kvp, acc) {
  1303. return !isFinite(kvp.value) && kvp.value === Infinity;
  1304. }
  1305. function negativeInfinity (kvp, acc) {
  1306. return !isFinite(kvp.value) && kvp.value !== Infinity;
  1307. }
  1308. function circular (kvp, acc) {
  1309. return acc.context.circular;
  1310. }
  1311. function maxDepth (kvp, acc) {
  1312. return (acc.options.maxDepth && acc.options.maxDepth <= acc.context.level);
  1313. }
  1314. var prune = compose(
  1315. always('#'),
  1316. constructorName(),
  1317. always('#'),
  1318. end()
  1319. );
  1320. var omitNaN = when(nan, compose(
  1321. always('NaN'),
  1322. end()
  1323. ));
  1324. var omitPositiveInfinity = when(positiveInfinity, compose(
  1325. always('Infinity'),
  1326. end()
  1327. ));
  1328. var omitNegativeInfinity = when(negativeInfinity, compose(
  1329. always('-Infinity'),
  1330. end()
  1331. ));
  1332. var omitCircular = when(circular, compose(
  1333. optionValue('circular'),
  1334. end()
  1335. ));
  1336. var omitMaxDepth = when(maxDepth, prune);
  1337. module.exports = {
  1338. filters: {
  1339. always: always,
  1340. optionValue: optionValue,
  1341. constructorName: constructorName,
  1342. json: json,
  1343. toStr: toStr,
  1344. prune: prune,
  1345. truncate: truncate,
  1346. decorateArray: decorateArray,
  1347. decorateObject: decorateObject
  1348. },
  1349. flow: {
  1350. compose: compose,
  1351. when: when,
  1352. allowedKeys: allowedKeys,
  1353. safeKeys: safeKeys,
  1354. arrayIndicesToKeys: arrayIndicesToKeys,
  1355. filter: filter,
  1356. iterate: iterate,
  1357. end: end
  1358. },
  1359. symbols: {
  1360. END: END,
  1361. ITERATE: ITERATE
  1362. },
  1363. always: function (str) {
  1364. return compose(always(str), end());
  1365. },
  1366. json: function () {
  1367. return compose(json(), end());
  1368. },
  1369. toStr: function () {
  1370. return compose(toStr(), end());
  1371. },
  1372. prune: function () {
  1373. return prune;
  1374. },
  1375. number: function () {
  1376. return compose(
  1377. omitNaN,
  1378. omitPositiveInfinity,
  1379. omitNegativeInfinity,
  1380. json(),
  1381. end()
  1382. );
  1383. },
  1384. newLike: function () {
  1385. return compose(
  1386. always('new '),
  1387. constructorName(),
  1388. always('('),
  1389. json(),
  1390. always(')'),
  1391. end()
  1392. );
  1393. },
  1394. array: function (predicate) {
  1395. return compose(
  1396. omitCircular,
  1397. omitMaxDepth,
  1398. decorateArray(),
  1399. arrayIndicesToKeys(),
  1400. filter(predicate),
  1401. iterate()
  1402. );
  1403. },
  1404. object: function (predicate, orderedWhiteList) {
  1405. return compose(
  1406. omitCircular,
  1407. omitMaxDepth,
  1408. constructorName(),
  1409. decorateObject(),
  1410. allowedKeys(orderedWhiteList),
  1411. safeKeys(),
  1412. filter(predicate),
  1413. iterate()
  1414. );
  1415. }
  1416. };
  1417. },{"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)
  1418. });