collect.js
Advanced tools
Comparing version 4.1.0 to 4.2.1
@@ -1,1 +0,1 @@ | ||
var collect=function(e){var n={};function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=n,i.d=function(t,r,e){i.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:e})},i.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(r,"a",r),r},i.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},i.p="",i(i.s=4)}([function(t,r,e){"use strict";function n(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}t.exports=function(r){var e=[];return Array.isArray(r)?e.push.apply(e,n(r)):"Collection"===r.constructor.name?e.push.apply(e,n(r.all())):Object.keys(r).forEach(function(t){return e.push(r[t])}),e}},function(t,r,e){"use strict";t.exports=function(t,r){try{return r.split(".").reduce(function(t,r){return t[r]},t)}catch(t){return null}}},function(t,r,e){"use strict";t.exports=function(t){return Array.isArray(t[0])?t[0]:t}},function(t,r,e){"use strict";t.exports=function(t){return void 0===t?this.sum()/this.items.length:new this.constructor(this.items).pluck(t).sum()/this.items.length}},function(t,r,e){"use strict";function n(t){this.items=t||[]}var i=e(5);"undefined"!=typeof Symbol&&(n.prototype[Symbol.iterator]=i),n.prototype.all=e(6),n.prototype.average=e(3),n.prototype.avg=e(3),n.prototype.chunk=e(7),n.prototype.collapse=e(8),n.prototype.combine=e(9),n.prototype.concat=e(10),n.prototype.contains=e(11),n.prototype.count=e(12),n.prototype.crossJoin=e(13),n.prototype.dd=e(14),n.prototype.diff=e(16),n.prototype.diffAssoc=e(17),n.prototype.diffKeys=e(18),n.prototype.dump=e(19),n.prototype.each=e(20),n.prototype.eachSpread=e(21),n.prototype.every=e(22),n.prototype.except=e(23),n.prototype.filter=e(24),n.prototype.first=e(25),n.prototype.firstWhere=e(26),n.prototype.flatMap=e(27),n.prototype.flatten=e(28),n.prototype.flip=e(29),n.prototype.forPage=e(30),n.prototype.forget=e(31),n.prototype.get=e(32),n.prototype.groupBy=e(33),n.prototype.has=e(34),n.prototype.implode=e(35),n.prototype.intersect=e(36),n.prototype.intersectByKeys=e(37),n.prototype.isEmpty=e(38),n.prototype.isNotEmpty=e(39),n.prototype.keyBy=e(40),n.prototype.keys=e(41),n.prototype.last=e(42),n.prototype.macro=e(43),n.prototype.map=e(44),n.prototype.mapSpread=e(45),n.prototype.mapToDictionary=e(46),n.prototype.mapInto=e(47),n.prototype.mapToGroups=e(48),n.prototype.mapWithKeys=e(49),n.prototype.max=e(50),n.prototype.median=e(51),n.prototype.merge=e(52),n.prototype.min=e(53),n.prototype.mode=e(54),n.prototype.nth=e(55),n.prototype.only=e(56),n.prototype.pad=e(57),n.prototype.partition=e(59),n.prototype.pipe=e(60),n.prototype.pluck=e(61),n.prototype.pop=e(62),n.prototype.prepend=e(63),n.prototype.pull=e(64),n.prototype.push=e(65),n.prototype.put=e(66),n.prototype.random=e(67),n.prototype.reduce=e(68),n.prototype.reject=e(69),n.prototype.reverse=e(70),n.prototype.search=e(71),n.prototype.shift=e(72),n.prototype.shuffle=e(73),n.prototype.slice=e(74),n.prototype.sort=e(75),n.prototype.sortBy=e(76),n.prototype.sortByDesc=e(77),n.prototype.splice=e(78),n.prototype.split=e(79),n.prototype.sum=e(80),n.prototype.take=e(81),n.prototype.tap=e(82),n.prototype.times=e(83),n.prototype.toArray=e(84),n.prototype.toJson=e(85),n.prototype.transform=e(86),n.prototype.unless=e(87),n.prototype.union=e(88),n.prototype.unique=e(89),n.prototype.unwrap=e(90),n.prototype.values=e(91),n.prototype.when=e(92),n.prototype.where=e(93),n.prototype.whereIn=e(94),n.prototype.whereNotIn=e(95),n.prototype.wrap=e(96),n.prototype.zip=e(97);var o=function(t){return new n(t)};t.exports=o,t.exports.default=o},function(t,r,e){"use strict";t.exports=function(){var t=this,r=-1;return{next:function(){return r+=1,{value:t.items[r],done:r>=t.items.length}}}}},function(t,r,e){"use strict";t.exports=function(){return this.items}},function(t,r,e){"use strict";var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(e){var n=this,i=[],o=0;if(Array.isArray(this.items))do{var t=this.items.slice(o,o+e),r=new this.constructor(t);i.push(r),o+=e}while(o<this.items.length);else if("object"===c(this.items))for(var s=Object.keys(this.items),u=function(){var t=s.slice(o,o+e),r=new n.constructor({});t.forEach(function(t){return r.put(t,n.items[t])}),i.push(r),o+=e};u(),o<s.length;);else i.push(new this.constructor([this.items]));return new this.constructor(i)}},function(t,r,e){"use strict";t.exports=function(){var t;return new this.constructor((t=[]).concat.apply(t,function(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}(this.items)))}},function(t,r,e){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){var e=this,n=t;n instanceof this.constructor&&(n=t.all());var i={};return Array.isArray(this.items)&&Array.isArray(n)?this.items.forEach(function(t,r){i[t]=n[r]}):"object"===o(this.items)&&"object"===(void 0===n?"undefined":o(n))?Object.keys(this.items).forEach(function(t,r){i[e.items[t]]=n[Object.keys(n)[r]]}):Array.isArray(this.items)?i[this.items[0]]=n:"string"==typeof this.items&&Array.isArray(n)?i[this.items]=n[0]:"string"==typeof this.items&&(i[this.items]=n),new this.constructor(i)}},function(t,r,e){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(r){var e=this,n=r;return r instanceof this.constructor?n=r.all():"object"===(void 0===r?"undefined":i(r))&&(n=[],Object.keys(r).forEach(function(t){n.push(r[t])})),n.forEach(function(r){"object"===(void 0===r?"undefined":i(r))?Object.keys(r).forEach(function(t){return e.items.push(r[t])}):e.items.push(r)}),this}},function(t,r,e){"use strict";var n=e(0);t.exports=function(e,r){if(void 0!==r)return Array.isArray(this.items)?0<this.items.filter(function(t){return void 0!==t[e]&&t[e]===r}).length:void 0!==this.items[e]&&this.items[e]===r;if("function"==typeof e)return 0<this.items.filter(function(t,r){return e(t,r)}).length;if(Array.isArray(this.items))return-1!==this.items.indexOf(e);var t=n(this.items);return t.push.apply(t,function(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}(Object.keys(this.items))),-1!==t.indexOf(e)}},function(t,r,e){"use strict";t.exports=function(){var t=0;return Array.isArray(this.items)&&(t=this.items.length),Math.max(Object.keys(this.items).length,t)}},function(t,r,e){"use strict";t.exports=function(){for(var t=arguments.length,r=Array(t),e=0;e<t;e++)r[e]=arguments[e];return new this.constructor(function t(r,e,n){var i=n[0];i instanceof e&&(i=i.all());for(var o=n.slice(1),s=!o.length,u=[],c=0;c<i.length;c+=1){var f=r.slice();f.push(i[c]),s?u.push(f):u=u.concat(t(f,e,o))}return u}([],this.constructor,[].concat([this.items],r)))}},function(r,t,e){"use strict";(function(t){r.exports=function(){this.dump(),void 0!==t&&t.exit(1)}}).call(t,e(15))},function(t,r){var e,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(r){if(e===setTimeout)return setTimeout(r,0);if((e===o||!e)&&setTimeout)return e=setTimeout,setTimeout(r,0);try{return e(r,0)}catch(t){try{return e.call(null,r,0)}catch(t){return e.call(this,r,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:o}catch(t){e=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,f=[],a=!1,h=-1;function p(){a&&c&&(a=!1,c.length?f=c.concat(f):h=-1,f.length&&y())}function y(){if(!a){var t=u(p);a=!0;for(var r=f.length;r;){for(c=f,f=[];++h<r;)c&&c[h].run();h=-1,r=f.length}c=null,a=!1,function(r){if(n===clearTimeout)return clearTimeout(r);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(r);try{n(r)}catch(t){try{return n.call(null,r)}catch(t){return n.call(this,r)}}}(t)}}function l(t,r){this.fun=t,this.array=r}function m(){}i.nextTick=function(t){var r=new Array(arguments.length-1);if(1<arguments.length)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];f.push(new l(t,r)),1!==f.length||a||u(y)},l.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,r,e){"use strict";t.exports=function(t){var r=void 0;r=t instanceof this.constructor?t.all():t;var e=this.items.filter(function(t){return-1===r.indexOf(t)});return new this.constructor(e)}},function(t,r,e){"use strict";t.exports=function(t){var r=this,e=t;t instanceof this.constructor&&(e=t.all());var n={};return Object.keys(this.items).forEach(function(t){void 0!==e[t]&&e[t]===r.items[t]||(n[t]=r.items[t])}),new this.constructor(n)}},function(t,r,e){"use strict";t.exports=function(t){var r=void 0;r=t instanceof this.constructor?t.all():t;var e=Object.keys(r),n=Object.keys(this.items).filter(function(t){return-1===e.indexOf(t)});return new this.constructor(this.items).only(n)}},function(t,r,e){"use strict";t.exports=function(){return console.log(this),this}},function(t,r,e){"use strict";t.exports=function(r){var e=this;return Array.isArray(this.items)?this.items.forEach(r):Object.keys(this.items).forEach(function(t){r(e.items[t],t,e.items)}),this}},function(t,r,e){"use strict";t.exports=function(e){return this.each(function(t,r){e.apply(void 0,function(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}(t).concat([r]))}),this}},function(t,r,e){"use strict";var n=e(0);t.exports=function(e){return-1===n(this.items).map(function(t,r){return e(t,r)}).indexOf(!1)}},function(t,r,e){"use strict";var u=e(2);t.exports=function(){for(var r=this,t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=u(e);if(Array.isArray(this.items)){var o=this.items.filter(function(t){return-1===i.indexOf(t)});return new this.constructor(o)}var s={};return Object.keys(this.items).forEach(function(t){-1===i.indexOf(t)&&(s[t]=r.items[t])}),new this.constructor(s)}},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function s(t){if(Array.isArray(t)){if(t.length)return!1}else if(null!=t&&"object"===(void 0===t?"undefined":n(t))){if(Object.keys(t).length)return!1}else if(t)return!1;return!0}t.exports=function(t){var r,e,n,i=t||!1,o=null;return o=Array.isArray(this.items)?function(t,r){if(t)return r.filter(t);for(var e=[],n=0;n<r.length;n+=1){var i=r[n];s(i)||e.push(i)}return e}(i,this.items):(r=i,e=this.items,n={},Object.keys(e).forEach(function(t){r?r(e[t],t)&&(n[t]=e[t]):s(e[t])||(n[t]=e[t])}),n),new this.constructor(o)}},function(t,r,e){"use strict";t.exports=function(t,r){if("function"==typeof t){for(var e=0,n=this.items.length;e<n;e+=1){var i=this.items[e];if(t(i))return i}return"function"==typeof r?r():r}if(Array.isArray(this.items)&&this.items.length||Object.keys(this.items).length){if(Array.isArray(this.items))return this.items[0];var o=Object.keys(this.items)[0];return this.items[o]}return"function"==typeof r?r():r}},function(t,r,e){"use strict";t.exports=function(t,r){return this.where(t,r).first()||null}},function(t,r,e){"use strict";t.exports=function(t){return this.map(t).collapse()}},function(t,r,e){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){var e=t||1/0,n=!1,i=[],r=function(r){i=[],Array.isArray(r)?r.forEach(function(r){"string"==typeof r?i.push(r):Array.isArray(r)?i=i.concat(r):Object.keys(r).forEach(function(t){i=i.concat(r[t])})}):Object.keys(r).forEach(function(t){"string"==typeof r[t]?i.push(r[t]):Array.isArray(r[t])?i=i.concat(r[t]):Object.keys(r).forEach(function(t){i=i.concat(r[t])})}),n=0===(n=i.filter(function(t){return"object"===(void 0===t?"undefined":o(t))})).length,e-=1};for(r(this.items);!n&&0<e;)r(i);return new this.constructor(i)}},function(t,r,e){"use strict";t.exports=function(){var r=this,e={};return Array.isArray(this.items)?Object.keys(this.items).forEach(function(t){e[r.items[t]]=Number(t)}):Object.keys(this.items).forEach(function(t){e[r.items[t]]=t}),new this.constructor(e)}},function(t,r,e){"use strict";t.exports=function(t,r){var e=this,n={};return Array.isArray(this.items)?n=this.items.slice(t*r-r,t*r):Object.keys(this.items).slice(t*r-r,t*r).forEach(function(t){n[t]=e.items[t]}),new this.constructor(n)}},function(t,r,e){"use strict";t.exports=function(t){return Array.isArray(this.items)?this.items.splice(t,1):delete this.items[t],this}},function(t,r,e){"use strict";t.exports=function(t){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return void 0!==this.items[t]?this.items[t]:"function"==typeof r?r():null!==r?r:null}},function(t,r,e){"use strict";t.exports=function(n){var i=this,o={};return this.items.forEach(function(t,r){var e=void 0;e="function"==typeof n?n(t,r):t[n]||"",void 0===o[e]&&(o[e]=new i.constructor([])),o[e].push(t)}),new this.constructor(o)}},function(t,r,e){"use strict";var o=e(2);t.exports=function(){for(var r=this,t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=o(e);return i.filter(function(t){return r.items[t]}).length===i.length}},function(t,r,e){"use strict";t.exports=function(t,r){return void 0===r?this.items.join(t):new this.constructor(this.items).pluck(t).all().join(r)}},function(t,r,e){"use strict";t.exports=function(t){var r=t;t instanceof this.constructor&&(r=t.all());var e=this.items.filter(function(t){return-1!==r.indexOf(t)});return new this.constructor(e)}},function(t,r,e){"use strict";t.exports=function(t){var r=this,e=Object.keys(t);t instanceof this.constructor&&(e=Object.keys(t.all()));var n={};return Object.keys(this.items).forEach(function(t){-1!==e.indexOf(t)&&(n[t]=r.items[t])}),new this.constructor(n)}},function(t,r,e){"use strict";t.exports=function(){return!this.items.length}},function(t,r,e){"use strict";t.exports=function(){return!!this.items.length}},function(t,r,e){"use strict";t.exports=function(r){var e={};return"function"==typeof r?this.items.forEach(function(t){e[r(t)]=t}):this.items.forEach(function(t){e[t[r]||""]=t}),new this.constructor(e)}},function(t,r,e){"use strict";t.exports=function(){var t=Object.keys(this.items);return Array.isArray(this.items)&&(t=t.map(Number)),new this.constructor(t)}},function(t,r,e){"use strict";t.exports=function(t,r){var e=this.items;if("function"==typeof t&&(e=this.filter(t).all()),Array.isArray(e)&&!e.length||!Object.keys(e).length)return"function"==typeof r?r():r;if(Array.isArray(e))return e[e.length-1];var n=Object.keys(e);return e[n[n.length-1]]}},function(t,r,e){"use strict";t.exports=function(t,r){this.constructor.prototype[t]=r}},function(t,r,e){"use strict";t.exports=function(r){var e=this;if(Array.isArray(this.items))return new this.constructor(this.items.map(r));var n={};return Object.keys(this.items).forEach(function(t){n[t]=r(e.items[t],t)}),new this.constructor(n)}},function(t,r,e){"use strict";t.exports=function(e){return this.map(function(t,r){return e.apply(void 0,function(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}(t).concat([r]))})}},function(t,r,e){"use strict";var c=function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,r){var e=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(e.push(s.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return e}(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")};t.exports=function(s){var u={};return this.items.forEach(function(t,r){var e=s(t,r),n=c(e,2),i=n[0],o=n[1];void 0===u[i]?u[i]=[o]:u[i].push(o)}),new this.constructor(u)}},function(t,r,e){"use strict";t.exports=function(e){return this.map(function(t,r){return new e(t,r)})}},function(t,r,e){"use strict";var c=function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,r){var e=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(e.push(s.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return e}(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")};t.exports=function(s){var u={};return this.items.forEach(function(t,r){var e=s(t,r),n=c(e,2),i=n[0],o=n[1];void 0===u[i]?u[i]=[o]:u[i].push(o)}),new this.constructor(u)}},function(t,r,e){"use strict";var c=function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,r){var e=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(e.push(s.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return e}(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")};t.exports=function(o){var s=this,u={};return Array.isArray(this.items)?this.items.forEach(function(t){var r=o(t),e=c(r,2),n=e[0],i=e[1];u[n]=i}):Object.keys(this.items).forEach(function(t){var r=o(s.items[t]),e=c(r,2),n=e[0],i=e[1];u[n]=i}),new this.constructor(u)}},function(t,r,e){"use strict";function n(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}t.exports=function(t){return"string"==typeof t?Math.max.apply(Math,n(this.pluck(t).all())):Math.max.apply(Math,n(this.items))}},function(t,r,e){"use strict";t.exports=function(t){var r=this.items.length;return void 0===t?r%2==0?(this.items[r/2-1]+this.items[r/2])/2:this.items[Math.floor(r/2)]:r%2==0?(this.items[r/2-1][t]+this.items[r/2][t])/2:this.items[Math.floor(r/2)][t]}},function(t,r,e){"use strict";t.exports=function(t){var r=t;if("string"==typeof r&&(r=[r]),Array.isArray(this.items)&&Array.isArray(r))return new this.constructor(this.items.concat(r));var e=JSON.parse(JSON.stringify(this.items));return Object.keys(r).forEach(function(t){e[t]=r[t]}),new this.constructor(e)}},function(t,r,e){"use strict";function n(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}t.exports=function(t){return void 0!==t?Math.min.apply(Math,n(this.pluck(t).all())):Math.min.apply(Math,n(this.items))}},function(t,r,e){"use strict";t.exports=function(n){var i=[],o=1;return this.items.length?(this.items.forEach(function(r){var t=i.filter(function(t){return void 0!==n?t.key===r[n]:t.key===r});if(t.length){t[0].count+=1;var e=t[0].count;o<e&&(o=e)}else void 0!==n?i.push({key:r[n],count:1}):i.push({key:r,count:1})}),i.filter(function(t){return t.count===o}).map(function(t){return t.key})):null}},function(t,r,e){"use strict";var n=e(0);t.exports=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=n(this.items).slice(t).filter(function(t,r){return r%e==0});return new this.constructor(r)}},function(t,r,e){"use strict";var u=e(2);t.exports=function(){for(var r=this,t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=u(e);if(Array.isArray(this.items)){var o=this.items.filter(function(t){return-1!==i.indexOf(t)});return new this.constructor(o)}var s={};return Object.keys(this.items).forEach(function(t){-1!==i.indexOf(t)&&(s[t]=r.items[t])}),new this.constructor(s)}},function(t,r,e){"use strict";var f=e(58);t.exports=function(t,r){var e=Math.abs(t),n=this.count();if(e<=n)return this;for(var i=e-n,o=f(this.items),s=Array.isArray(this.items),u=t<0,c=0;c<i;)s?u?o.unshift(r):o.push(r):void 0!==o[c]?i+=1:o[c]=r,c+=1;return new this.constructor(o)}},function(t,r,e){"use strict";t.exports=function(r){var t,e=void 0;Array.isArray(r)?(t=e=[]).push.apply(t,function(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}(r)):(e={},Object.keys(r).forEach(function(t){e[t]=r[t]}));return e}},function(t,r,e){"use strict";t.exports=function(e){var n=this,i=void 0;return Array.isArray(this.items)?(i=[new this.constructor([]),new this.constructor([])],this.items.forEach(function(t){!0===e(t)?i[0].push(t):i[1].push(t)})):(i=[new this.constructor({}),new this.constructor({})],Object.keys(this.items).forEach(function(t){var r=n.items[t];!0===e(r)?i[0].put(t,r):i[1].put(t,r)})),new this.constructor(i)}},function(t,r,e){"use strict";t.exports=function(t){return t(this)}},function(t,r,e){"use strict";var y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l=e(1);t.exports=function(r,e){if(-1!==r.indexOf("*")){var n=(t=this.items,h={},t.forEach(function(t,r){!function r(e,n){"object"===(void 0===e?"undefined":y(e))&&Object.keys(e).forEach(function(t){r(e[t],n+"."+t)}),h[n]=e}(t,r)}),h),i=[];if(void 0!==e){var o=new RegExp("0."+e,"g"),s=("0."+e).split(".").length;Object.keys(n).forEach(function(t){var r=t.match(o);if(r){var e=r[0];e.split(".").length===s&&i.push(n[e])}})}var u=[],c=new RegExp("0."+r,"g"),f=("0."+r).split(".").length;if(Object.keys(n).forEach(function(t){var r=t.match(c);if(r){var e=r[0];e.split(".").length===f&&u.push(n[e])}}),void 0===e)return new this.constructor([u]);var a={};return this.items.forEach(function(t,r){a[i[r]||""]=u}),new this.constructor(a)}var t,h;if(void 0===e)return this.map(function(t){return void 0!==l(t,r)?l(t,r):null});var p={};return this.items.forEach(function(t){void 0!==l(t,r)?p[t[e]||""]=l(t,r):p[t[e]||""]=null}),new this.constructor(p)}},function(t,r,e){"use strict";t.exports=function(){if(Array.isArray(this.items))return this.items.pop();var t=Object.keys(this.items),r=t[t.length-1],e=this.items[r];return delete this.items[r],e}},function(t,r,e){"use strict";t.exports=function(t,r){return void 0!==r?this.put(r,t):(this.items.unshift(t),this)}},function(t,r,e){"use strict";t.exports=function(t,r){var e=this.items[t]||null;return e||void 0===r||(e="function"==typeof r?r():r),delete this.items[t],e}},function(t,r,e){"use strict";t.exports=function(){var t;return(t=this.items).push.apply(t,arguments),this}},function(t,r,e){"use strict";t.exports=function(t,r){return this.items[t]=r,this}},function(t,r,e){"use strict";var n=e(0);t.exports=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,r=n(this.items),e=new this.constructor(r).shuffle();return 1===t?e.first():e.take(t)}},function(t,r,e){"use strict";t.exports=function(r,t){var e=this,n=null;return void 0!==t&&(n=t),Array.isArray(this.items)?this.items.forEach(function(t){n=r(n,t)}):Object.keys(this.items).forEach(function(t){n=r(n,e.items[t],t)}),n}},function(t,r,e){"use strict";t.exports=function(r){return new this.constructor(this.items).filter(function(t){return!r(t)})}},function(t,r,e){"use strict";t.exports=function(){var t=[].concat(this.items).reverse();return new this.constructor(t)}},function(t,r,e){"use strict";t.exports=function(e,r){var n=this,i=e;"function"==typeof e&&(i=this.items.filter(function(t,r){return e(t,r)})[0]);var t=!1;if(!Array.isArray(this.items))return Object.keys(this.items).filter(function(t){return!0===r?n.items[t]===i:n.items[t]===Number(i)||n.items[t]===i.toString()})[0]||!1;var o=this.items.filter(function(t){return!0===r?t===i:t===Number(i)||t===i.toString()})[0];return-1!==(t=this.items.indexOf(o))&&t}},function(t,r,e){"use strict";t.exports=function(){if(Array.isArray(this.items))return this.items.shift();var t=Object.keys(this.items)[0],r=this.items[t]||null;return delete this.items[t],r}},function(t,r,e){"use strict";var i=e(0);t.exports=function(){var t=i(this.items),r=void 0,e=void 0,n=void 0;for(n=t.length;n;n-=1)r=Math.floor(Math.random()*n),e=t[n-1],t[n-1]=t[r],t[r]=e;return this.items=t,this}},function(t,r,e){"use strict";t.exports=function(t,r){var e=this.items.slice(t);return void 0!==r&&(e=e.slice(0,r)),new this.constructor(e)}},function(t,r,e){"use strict";t.exports=function(t){var r=[].concat(this.items);return void 0===t?this.every(function(t){return"number"==typeof t})?r.sort(function(t,r){return t-r}):r.sort():r.sort(t),new this.constructor(r)}},function(t,r,e){"use strict";t.exports=function(e){var t=[].concat(this.items);return"function"==typeof e?t.sort(function(t,r){return e(t)<e(r)?-1:e(t)>e(r)?1:0}):t.sort(function(t,r){return t[e]<r[e]?-1:t[e]>r[e]?1:0}),new this.constructor(t)}},function(t,r,e){"use strict";t.exports=function(t){return this.sortBy(t).reverse()}},function(t,r,e){"use strict";t.exports=function(t,r,e){var n=this.slice(t,r);if(this.items=this.diff(n.all()).all(),Array.isArray(e))for(var i=0,o=e.length;i<o;i+=1)this.items.splice(t+i,0,e[i]);return n}},function(t,r,e){"use strict";t.exports=function(t){for(var r=Math.round(this.items.length/t),e=JSON.parse(JSON.stringify(this.items)),n=[],i=0;i<t;i+=1)n.push(new this.constructor(e.splice(0,r)));return new this.constructor(n)}},function(t,r,e){"use strict";t.exports=function(t){var r=0;if(void 0===t)for(var e=0,n=this.items.length;e<n;e+=1)r+=this.items[e];else if("function"==typeof t)for(var i=0,o=this.items.length;i<o;i+=1)r+=t(this.items[i]);else for(var s=0,u=this.items.length;s<u;s+=1)r+=this.items[s][t];return r}},function(t,r,e){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){var r=this;if(Array.isArray(this.items)||"object"!==o(this.items))return t<0?new this.constructor(this.items.slice(t)):new this.constructor(this.items.slice(0,t));var e=Object.keys(this.items),n=void 0;n=t<0?e.slice(t):e.slice(0,t);var i={};return e.forEach(function(t){-1!==n.indexOf(t)&&(i[t]=r.items[t])}),new this.constructor(i)}},function(t,r,e){"use strict";t.exports=function(t){return t(this),this}},function(t,r,e){"use strict";t.exports=function(t,r){for(var e=1;e<=t;e+=1)this.items.push(r(e));return this}},function(t,r,e){"use strict";t.exports=function(){var i=this.constructor;if(Array.isArray(this.items)){var r=[];return this.items.forEach(function(t){!function r(t,e){var n=[];t instanceof i?(t.items.forEach(function(t){return r(t,n)}),e.push(n)):Array.isArray(t)?(t.forEach(function(t){return r(t,n)}),e.push(n)):e.push(t)}(t,r)}),r}return this.values().all()}},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(){return"object"!==n(this.items)||Array.isArray(this.items)?JSON.stringify(this.toArray()):JSON.stringify(this.all())}},function(t,r,e){"use strict";t.exports=function(r){var e=this;if(Array.isArray(this.items))this.items=this.items.map(r);else{var n={};Object.keys(this.items).forEach(function(t){n[t]=r(e.items[t],t)}),this.items=n}return this}},function(t,r,e){"use strict";t.exports=function(t,r,e){t?e(this):r(this)}},function(t,r,e){"use strict";t.exports=function(r){var e=this,n=JSON.parse(JSON.stringify(this.items));return Object.keys(r).forEach(function(t){void 0===e.items[t]&&(n[t]=r[t])}),new this.constructor(n)}},function(t,r,e){"use strict";t.exports=function(t){var r=void 0;if(void 0===t)r=this.items.filter(function(t,r,e){return e.indexOf(t)===r});else{r=[];for(var e=[],n=0,i=this.items.length;n<i;n+=1){var o=void 0;o="function"==typeof t?t(this.items[n]):this.items[n][t],-1===e.indexOf(o)&&(r.push(this.items[n]),e.push(o))}}return new this.constructor(r)}},function(t,r,e){"use strict";t.exports=function(t){return t instanceof this.constructor?t.all():t}},function(t,r,e){"use strict";t.exports=function(){var r=this,e=[];return Object.keys(this.items).forEach(function(t){e.push(r.items[t])}),new this.constructor(e)}},function(t,r,e){"use strict";t.exports=function(t,r,e){return t?r(this,t):e?e(this,t):this}},function(t,r,e){"use strict";var s=e(0),u=e(1);t.exports=function(r,t,e){var n=t,i=e;void 0===e&&(i=t,n="===");var o=s(this.items).filter(function(t){switch(n){case"==":return u(t,r)===Number(i)||u(t,r)===i.toString();default:case"===":return u(t,r)===i;case"!=":case"<>":return u(t,r)!==Number(i)&&u(t,r)!==i.toString();case"!==":return u(t,r)!==i;case"<":return u(t,r)<i;case"<=":return u(t,r)<=i;case">":return u(t,r)>i;case">=":return u(t,r)>=i}});return new this.constructor(o)}},function(t,r,e){"use strict";var i=e(0),o=e(1);t.exports=function(r,t){var e=i(t),n=this.items.filter(function(t){return-1!==e.indexOf(o(t,r))});return new this.constructor(n)}},function(t,r,e){"use strict";var i=e(0),o=e(1);t.exports=function(r,t){var e=i(t),n=this.items.filter(function(t){return-1===e.indexOf(o(t,r))});return new this.constructor(n)}},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){return t instanceof this.constructor?t:"object"===(void 0===t?"undefined":n(t))?new this.constructor(t):new this.constructor([t])}},function(t,r,e){"use strict";t.exports=function(t){var e=this,n=t;n instanceof this.constructor&&(n=n.all());var r=this.items.map(function(t,r){return new e.constructor([t,n[r]])});return new this.constructor(r)}}]); | ||
var collect=function(e){var n={};function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=n,i.d=function(t,r,e){i.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:e})},i.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(r,"a",r),r},i.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},i.p="",i(i.s=6)}([function(t,r,e){"use strict";function n(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}t.exports=function(r){var e=[];return Array.isArray(r)?e.push.apply(e,n(r)):"Collection"===r.constructor.name?e.push.apply(e,n(r.all())):Object.keys(r).forEach(function(t){return e.push(r[t])}),e}},function(t,r,e){"use strict";t.exports=function(t,r){try{return r.split(".").reduce(function(t,r){return t[r]},t)}catch(t){return null}}},function(t,r,e){"use strict";t.exports=function(t){return Array.isArray(t[0])?t[0]:t}},function(t,r,e){"use strict";t.exports=function(t){return void 0===t?this.sum()/this.items.length:new this.constructor(this.items).pluck(t).sum()/this.items.length}},function(t,r,e){"use strict";t.exports=function(t,r){if(Array.isArray(this.items)&&this.items.length)return t(this);if(Object.keys(this.items).length)return t(this);if(void 0!==r){if(Array.isArray(this.items)&&!this.items.length)return r(this);if(!Object.keys(this.items).length)return r(this)}return this}},function(t,r,e){"use strict";t.exports=function(t,r){if(Array.isArray(this.items)&&!this.items.length)return t(this);if(!Object.keys(this.items).length)return t(this);if(void 0!==r){if(Array.isArray(this.items)&&this.items.length)return r(this);if(Object.keys(this.items).length)return r(this)}return this}},function(t,r,e){"use strict";function n(t){this.items=t||[]}var i=e(7);"undefined"!=typeof Symbol&&(n.prototype[Symbol.iterator]=i),n.prototype.all=e(8),n.prototype.average=e(3),n.prototype.avg=e(3),n.prototype.chunk=e(9),n.prototype.collapse=e(10),n.prototype.combine=e(11),n.prototype.concat=e(12),n.prototype.contains=e(13),n.prototype.count=e(14),n.prototype.crossJoin=e(15),n.prototype.dd=e(16),n.prototype.diff=e(18),n.prototype.diffAssoc=e(19),n.prototype.diffKeys=e(20),n.prototype.dump=e(21),n.prototype.each=e(22),n.prototype.eachSpread=e(23),n.prototype.every=e(24),n.prototype.except=e(25),n.prototype.filter=e(26),n.prototype.first=e(27),n.prototype.firstWhere=e(28),n.prototype.flatMap=e(29),n.prototype.flatten=e(30),n.prototype.flip=e(31),n.prototype.forPage=e(32),n.prototype.forget=e(33),n.prototype.get=e(34),n.prototype.groupBy=e(35),n.prototype.has=e(36),n.prototype.implode=e(37),n.prototype.intersect=e(38),n.prototype.intersectByKeys=e(39),n.prototype.isEmpty=e(40),n.prototype.isNotEmpty=e(41),n.prototype.keyBy=e(42),n.prototype.keys=e(43),n.prototype.last=e(44),n.prototype.macro=e(45),n.prototype.map=e(46),n.prototype.mapSpread=e(47),n.prototype.mapToDictionary=e(48),n.prototype.mapInto=e(49),n.prototype.mapToGroups=e(50),n.prototype.mapWithKeys=e(51),n.prototype.max=e(52),n.prototype.median=e(53),n.prototype.merge=e(54),n.prototype.min=e(55),n.prototype.mode=e(56),n.prototype.nth=e(57),n.prototype.only=e(58),n.prototype.pad=e(59),n.prototype.partition=e(61),n.prototype.pipe=e(62),n.prototype.pluck=e(63),n.prototype.pop=e(64),n.prototype.prepend=e(65),n.prototype.pull=e(66),n.prototype.push=e(67),n.prototype.put=e(68),n.prototype.random=e(69),n.prototype.reduce=e(70),n.prototype.reject=e(71),n.prototype.reverse=e(72),n.prototype.search=e(73),n.prototype.shift=e(74),n.prototype.shuffle=e(75),n.prototype.slice=e(76),n.prototype.sort=e(77),n.prototype.sortBy=e(78),n.prototype.sortByDesc=e(79),n.prototype.splice=e(80),n.prototype.split=e(81),n.prototype.sum=e(82),n.prototype.take=e(83),n.prototype.tap=e(84),n.prototype.times=e(85),n.prototype.toArray=e(86),n.prototype.toJson=e(87),n.prototype.transform=e(88),n.prototype.unless=e(89),n.prototype.unlessEmpty=e(4),n.prototype.unlessNotEmpty=e(5),n.prototype.union=e(90),n.prototype.unique=e(91),n.prototype.unwrap=e(92),n.prototype.values=e(93),n.prototype.when=e(94),n.prototype.whenEmpty=e(5),n.prototype.whenNotEmpty=e(4),n.prototype.where=e(95),n.prototype.whereIn=e(96),n.prototype.whereNotIn=e(97),n.prototype.wrap=e(98),n.prototype.zip=e(99);var o=function(t){return new n(t)};t.exports=o,t.exports.default=o},function(t,r,e){"use strict";t.exports=function(){var t=this,r=-1;return{next:function(){return r+=1,{value:t.items[r],done:r>=t.items.length}}}}},function(t,r,e){"use strict";t.exports=function(){return this.items}},function(t,r,e){"use strict";var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(e){var n=this,i=[],o=0;if(Array.isArray(this.items))do{var t=this.items.slice(o,o+e),r=new this.constructor(t);i.push(r),o+=e}while(o<this.items.length);else if("object"===c(this.items))for(var s=Object.keys(this.items),u=function(){var t=s.slice(o,o+e),r=new n.constructor({});t.forEach(function(t){return r.put(t,n.items[t])}),i.push(r),o+=e};u(),o<s.length;);else i.push(new this.constructor([this.items]));return new this.constructor(i)}},function(t,r,e){"use strict";t.exports=function(){var t;return new this.constructor((t=[]).concat.apply(t,function(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}(this.items)))}},function(t,r,e){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){var e=this,n=t;n instanceof this.constructor&&(n=t.all());var i={};return Array.isArray(this.items)&&Array.isArray(n)?this.items.forEach(function(t,r){i[t]=n[r]}):"object"===o(this.items)&&"object"===(void 0===n?"undefined":o(n))?Object.keys(this.items).forEach(function(t,r){i[e.items[t]]=n[Object.keys(n)[r]]}):Array.isArray(this.items)?i[this.items[0]]=n:"string"==typeof this.items&&Array.isArray(n)?i[this.items]=n[0]:"string"==typeof this.items&&(i[this.items]=n),new this.constructor(i)}},function(t,r,e){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(r){var e=this,n=r;return r instanceof this.constructor?n=r.all():"object"===(void 0===r?"undefined":i(r))&&(n=[],Object.keys(r).forEach(function(t){n.push(r[t])})),n.forEach(function(r){"object"===(void 0===r?"undefined":i(r))?Object.keys(r).forEach(function(t){return e.items.push(r[t])}):e.items.push(r)}),this}},function(t,r,e){"use strict";var n=e(0);t.exports=function(e,r){if(void 0!==r)return Array.isArray(this.items)?0<this.items.filter(function(t){return void 0!==t[e]&&t[e]===r}).length:void 0!==this.items[e]&&this.items[e]===r;if("function"==typeof e)return 0<this.items.filter(function(t,r){return e(t,r)}).length;if(Array.isArray(this.items))return-1!==this.items.indexOf(e);var t=n(this.items);return t.push.apply(t,function(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}(Object.keys(this.items))),-1!==t.indexOf(e)}},function(t,r,e){"use strict";t.exports=function(){var t=0;return Array.isArray(this.items)&&(t=this.items.length),Math.max(Object.keys(this.items).length,t)}},function(t,r,e){"use strict";t.exports=function(){for(var t=arguments.length,r=Array(t),e=0;e<t;e++)r[e]=arguments[e];return new this.constructor(function t(r,e,n){var i=n[0];i instanceof e&&(i=i.all());for(var o=n.slice(1),s=!o.length,u=[],c=0;c<i.length;c+=1){var f=r.slice();f.push(i[c]),s?u.push(f):u=u.concat(t(f,e,o))}return u}([],this.constructor,[].concat([this.items],r)))}},function(r,t,e){"use strict";(function(t){r.exports=function(){this.dump(),void 0!==t&&t.exit(1)}}).call(t,e(17))},function(t,r){var e,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(r){if(e===setTimeout)return setTimeout(r,0);if((e===o||!e)&&setTimeout)return e=setTimeout,setTimeout(r,0);try{return e(r,0)}catch(t){try{return e.call(null,r,0)}catch(t){return e.call(this,r,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:o}catch(t){e=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,f=[],h=!1,a=-1;function p(){h&&c&&(h=!1,c.length?f=c.concat(f):a=-1,f.length&&y())}function y(){if(!h){var t=u(p);h=!0;for(var r=f.length;r;){for(c=f,f=[];++a<r;)c&&c[a].run();a=-1,r=f.length}c=null,h=!1,function(r){if(n===clearTimeout)return clearTimeout(r);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(r);try{n(r)}catch(t){try{return n.call(null,r)}catch(t){return n.call(this,r)}}}(t)}}function l(t,r){this.fun=t,this.array=r}function m(){}i.nextTick=function(t){var r=new Array(arguments.length-1);if(1<arguments.length)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];f.push(new l(t,r)),1!==f.length||h||u(y)},l.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,r,e){"use strict";t.exports=function(t){var r=void 0;r=t instanceof this.constructor?t.all():t;var e=this.items.filter(function(t){return-1===r.indexOf(t)});return new this.constructor(e)}},function(t,r,e){"use strict";t.exports=function(t){var r=this,e=t;t instanceof this.constructor&&(e=t.all());var n={};return Object.keys(this.items).forEach(function(t){void 0!==e[t]&&e[t]===r.items[t]||(n[t]=r.items[t])}),new this.constructor(n)}},function(t,r,e){"use strict";t.exports=function(t){var r=void 0;r=t instanceof this.constructor?t.all():t;var e=Object.keys(r),n=Object.keys(this.items).filter(function(t){return-1===e.indexOf(t)});return new this.constructor(this.items).only(n)}},function(t,r,e){"use strict";t.exports=function(){return console.log(this),this}},function(t,r,e){"use strict";t.exports=function(r){var e=this;return Array.isArray(this.items)?this.items.forEach(r):Object.keys(this.items).forEach(function(t){r(e.items[t],t,e.items)}),this}},function(t,r,e){"use strict";t.exports=function(e){return this.each(function(t,r){e.apply(void 0,function(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}(t).concat([r]))}),this}},function(t,r,e){"use strict";var n=e(0);t.exports=function(e){return-1===n(this.items).map(function(t,r){return e(t,r)}).indexOf(!1)}},function(t,r,e){"use strict";var u=e(2);t.exports=function(){for(var r=this,t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=u(e);if(Array.isArray(this.items)){var o=this.items.filter(function(t){return-1===i.indexOf(t)});return new this.constructor(o)}var s={};return Object.keys(this.items).forEach(function(t){-1===i.indexOf(t)&&(s[t]=r.items[t])}),new this.constructor(s)}},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function s(t){if(Array.isArray(t)){if(t.length)return!1}else if(null!=t&&"object"===(void 0===t?"undefined":n(t))){if(Object.keys(t).length)return!1}else if(t)return!1;return!0}t.exports=function(t){var r,e,n,i=t||!1,o=null;return o=Array.isArray(this.items)?function(t,r){if(t)return r.filter(t);for(var e=[],n=0;n<r.length;n+=1){var i=r[n];s(i)||e.push(i)}return e}(i,this.items):(r=i,e=this.items,n={},Object.keys(e).forEach(function(t){r?r(e[t],t)&&(n[t]=e[t]):s(e[t])||(n[t]=e[t])}),n),new this.constructor(o)}},function(t,r,e){"use strict";t.exports=function(t,r){if("function"==typeof t){for(var e=0,n=this.items.length;e<n;e+=1){var i=this.items[e];if(t(i))return i}return"function"==typeof r?r():r}if(Array.isArray(this.items)&&this.items.length||Object.keys(this.items).length){if(Array.isArray(this.items))return this.items[0];var o=Object.keys(this.items)[0];return this.items[o]}return"function"==typeof r?r():r}},function(t,r,e){"use strict";t.exports=function(t,r){return this.where(t,r).first()||null}},function(t,r,e){"use strict";t.exports=function(t){return this.map(t).collapse()}},function(t,r,e){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){var e=t||1/0,n=!1,i=[],r=function(r){i=[],Array.isArray(r)?r.forEach(function(r){"string"==typeof r?i.push(r):Array.isArray(r)?i=i.concat(r):Object.keys(r).forEach(function(t){i=i.concat(r[t])})}):Object.keys(r).forEach(function(t){"string"==typeof r[t]?i.push(r[t]):Array.isArray(r[t])?i=i.concat(r[t]):Object.keys(r).forEach(function(t){i=i.concat(r[t])})}),n=0===(n=i.filter(function(t){return"object"===(void 0===t?"undefined":o(t))})).length,e-=1};for(r(this.items);!n&&0<e;)r(i);return new this.constructor(i)}},function(t,r,e){"use strict";t.exports=function(){var r=this,e={};return Array.isArray(this.items)?Object.keys(this.items).forEach(function(t){e[r.items[t]]=Number(t)}):Object.keys(this.items).forEach(function(t){e[r.items[t]]=t}),new this.constructor(e)}},function(t,r,e){"use strict";t.exports=function(t,r){var e=this,n={};return Array.isArray(this.items)?n=this.items.slice(t*r-r,t*r):Object.keys(this.items).slice(t*r-r,t*r).forEach(function(t){n[t]=e.items[t]}),new this.constructor(n)}},function(t,r,e){"use strict";t.exports=function(t){return Array.isArray(this.items)?this.items.splice(t,1):delete this.items[t],this}},function(t,r,e){"use strict";t.exports=function(t){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return void 0!==this.items[t]?this.items[t]:"function"==typeof r?r():null!==r?r:null}},function(t,r,e){"use strict";t.exports=function(n){var i=this,o={};return this.items.forEach(function(t,r){var e=void 0;e="function"==typeof n?n(t,r):t[n]||"",void 0===o[e]&&(o[e]=new i.constructor([])),o[e].push(t)}),new this.constructor(o)}},function(t,r,e){"use strict";var o=e(2);t.exports=function(){for(var r=this,t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=o(e);return i.filter(function(t){return r.items[t]}).length===i.length}},function(t,r,e){"use strict";t.exports=function(t,r){return void 0===r?this.items.join(t):new this.constructor(this.items).pluck(t).all().join(r)}},function(t,r,e){"use strict";t.exports=function(t){var r=t;t instanceof this.constructor&&(r=t.all());var e=this.items.filter(function(t){return-1!==r.indexOf(t)});return new this.constructor(e)}},function(t,r,e){"use strict";t.exports=function(t){var r=this,e=Object.keys(t);t instanceof this.constructor&&(e=Object.keys(t.all()));var n={};return Object.keys(this.items).forEach(function(t){-1!==e.indexOf(t)&&(n[t]=r.items[t])}),new this.constructor(n)}},function(t,r,e){"use strict";t.exports=function(){return!this.items.length}},function(t,r,e){"use strict";t.exports=function(){return!!this.items.length}},function(t,r,e){"use strict";t.exports=function(r){var e={};return"function"==typeof r?this.items.forEach(function(t){e[r(t)]=t}):this.items.forEach(function(t){e[t[r]||""]=t}),new this.constructor(e)}},function(t,r,e){"use strict";t.exports=function(){var t=Object.keys(this.items);return Array.isArray(this.items)&&(t=t.map(Number)),new this.constructor(t)}},function(t,r,e){"use strict";t.exports=function(t,r){var e=this.items;if("function"==typeof t&&(e=this.filter(t).all()),Array.isArray(e)&&!e.length||!Object.keys(e).length)return"function"==typeof r?r():r;if(Array.isArray(e))return e[e.length-1];var n=Object.keys(e);return e[n[n.length-1]]}},function(t,r,e){"use strict";t.exports=function(t,r){this.constructor.prototype[t]=r}},function(t,r,e){"use strict";t.exports=function(r){var e=this;if(Array.isArray(this.items))return new this.constructor(this.items.map(r));var n={};return Object.keys(this.items).forEach(function(t){n[t]=r(e.items[t],t)}),new this.constructor(n)}},function(t,r,e){"use strict";t.exports=function(e){return this.map(function(t,r){return e.apply(void 0,function(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}(t).concat([r]))})}},function(t,r,e){"use strict";var c=function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,r){var e=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(e.push(s.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return e}(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")};t.exports=function(s){var u={};return this.items.forEach(function(t,r){var e=s(t,r),n=c(e,2),i=n[0],o=n[1];void 0===u[i]?u[i]=[o]:u[i].push(o)}),new this.constructor(u)}},function(t,r,e){"use strict";t.exports=function(e){return this.map(function(t,r){return new e(t,r)})}},function(t,r,e){"use strict";var c=function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,r){var e=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(e.push(s.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return e}(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")};t.exports=function(s){var u={};return this.items.forEach(function(t,r){var e=s(t,r),n=c(e,2),i=n[0],o=n[1];void 0===u[i]?u[i]=[o]:u[i].push(o)}),new this.constructor(u)}},function(t,r,e){"use strict";var c=function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,r){var e=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(e.push(s.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return e}(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")};t.exports=function(o){var s=this,u={};return Array.isArray(this.items)?this.items.forEach(function(t){var r=o(t),e=c(r,2),n=e[0],i=e[1];u[n]=i}):Object.keys(this.items).forEach(function(t){var r=o(s.items[t]),e=c(r,2),n=e[0],i=e[1];u[n]=i}),new this.constructor(u)}},function(t,r,e){"use strict";function n(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}t.exports=function(t){return"string"==typeof t?Math.max.apply(Math,n(this.pluck(t).all())):Math.max.apply(Math,n(this.items))}},function(t,r,e){"use strict";t.exports=function(t){var r=this.items.length;return void 0===t?r%2==0?(this.items[r/2-1]+this.items[r/2])/2:this.items[Math.floor(r/2)]:r%2==0?(this.items[r/2-1][t]+this.items[r/2][t])/2:this.items[Math.floor(r/2)][t]}},function(t,r,e){"use strict";t.exports=function(t){var r=t;if("string"==typeof r&&(r=[r]),Array.isArray(this.items)&&Array.isArray(r))return new this.constructor(this.items.concat(r));var e=JSON.parse(JSON.stringify(this.items));return Object.keys(r).forEach(function(t){e[t]=r[t]}),new this.constructor(e)}},function(t,r,e){"use strict";function n(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}t.exports=function(t){return void 0!==t?Math.min.apply(Math,n(this.pluck(t).all())):Math.min.apply(Math,n(this.items))}},function(t,r,e){"use strict";t.exports=function(n){var i=[],o=1;return this.items.length?(this.items.forEach(function(r){var t=i.filter(function(t){return void 0!==n?t.key===r[n]:t.key===r});if(t.length){t[0].count+=1;var e=t[0].count;o<e&&(o=e)}else void 0!==n?i.push({key:r[n],count:1}):i.push({key:r,count:1})}),i.filter(function(t){return t.count===o}).map(function(t){return t.key})):null}},function(t,r,e){"use strict";var n=e(0);t.exports=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=n(this.items).slice(t).filter(function(t,r){return r%e==0});return new this.constructor(r)}},function(t,r,e){"use strict";var u=e(2);t.exports=function(){for(var r=this,t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=u(e);if(Array.isArray(this.items)){var o=this.items.filter(function(t){return-1!==i.indexOf(t)});return new this.constructor(o)}var s={};return Object.keys(this.items).forEach(function(t){-1!==i.indexOf(t)&&(s[t]=r.items[t])}),new this.constructor(s)}},function(t,r,e){"use strict";var f=e(60);t.exports=function(t,r){var e=Math.abs(t),n=this.count();if(e<=n)return this;for(var i=e-n,o=f(this.items),s=Array.isArray(this.items),u=t<0,c=0;c<i;)s?u?o.unshift(r):o.push(r):void 0!==o[c]?i+=1:o[c]=r,c+=1;return new this.constructor(o)}},function(t,r,e){"use strict";t.exports=function(r){var t,e=void 0;Array.isArray(r)?(t=e=[]).push.apply(t,function(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}(r)):(e={},Object.keys(r).forEach(function(t){e[t]=r[t]}));return e}},function(t,r,e){"use strict";t.exports=function(e){var n=this,i=void 0;return Array.isArray(this.items)?(i=[new this.constructor([]),new this.constructor([])],this.items.forEach(function(t){!0===e(t)?i[0].push(t):i[1].push(t)})):(i=[new this.constructor({}),new this.constructor({})],Object.keys(this.items).forEach(function(t){var r=n.items[t];!0===e(r)?i[0].put(t,r):i[1].put(t,r)})),new this.constructor(i)}},function(t,r,e){"use strict";t.exports=function(t){return t(this)}},function(t,r,e){"use strict";var y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l=e(1);t.exports=function(r,e){if(-1!==r.indexOf("*")){var n=(t=this.items,a={},t.forEach(function(t,r){!function r(e,n){"object"===(void 0===e?"undefined":y(e))&&Object.keys(e).forEach(function(t){r(e[t],n+"."+t)}),a[n]=e}(t,r)}),a),i=[];if(void 0!==e){var o=new RegExp("0."+e,"g"),s=("0."+e).split(".").length;Object.keys(n).forEach(function(t){var r=t.match(o);if(r){var e=r[0];e.split(".").length===s&&i.push(n[e])}})}var u=[],c=new RegExp("0."+r,"g"),f=("0."+r).split(".").length;if(Object.keys(n).forEach(function(t){var r=t.match(c);if(r){var e=r[0];e.split(".").length===f&&u.push(n[e])}}),void 0===e)return new this.constructor([u]);var h={};return this.items.forEach(function(t,r){h[i[r]||""]=u}),new this.constructor(h)}var t,a;if(void 0===e)return this.map(function(t){return void 0!==l(t,r)?l(t,r):null});var p={};return this.items.forEach(function(t){void 0!==l(t,r)?p[t[e]||""]=l(t,r):p[t[e]||""]=null}),new this.constructor(p)}},function(t,r,e){"use strict";t.exports=function(){if(Array.isArray(this.items))return this.items.pop();var t=Object.keys(this.items),r=t[t.length-1],e=this.items[r];return delete this.items[r],e}},function(t,r,e){"use strict";t.exports=function(t,r){return void 0!==r?this.put(r,t):(this.items.unshift(t),this)}},function(t,r,e){"use strict";t.exports=function(t,r){var e=this.items[t]||null;return e||void 0===r||(e="function"==typeof r?r():r),delete this.items[t],e}},function(t,r,e){"use strict";t.exports=function(){var t;return(t=this.items).push.apply(t,arguments),this}},function(t,r,e){"use strict";t.exports=function(t,r){return this.items[t]=r,this}},function(t,r,e){"use strict";var n=e(0);t.exports=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,r=n(this.items),e=new this.constructor(r).shuffle();return 1===t?e.first():e.take(t)}},function(t,r,e){"use strict";t.exports=function(r,t){var e=this,n=null;return void 0!==t&&(n=t),Array.isArray(this.items)?this.items.forEach(function(t){n=r(n,t)}):Object.keys(this.items).forEach(function(t){n=r(n,e.items[t],t)}),n}},function(t,r,e){"use strict";t.exports=function(r){return new this.constructor(this.items).filter(function(t){return!r(t)})}},function(t,r,e){"use strict";t.exports=function(){var t=[].concat(this.items).reverse();return new this.constructor(t)}},function(t,r,e){"use strict";t.exports=function(e,r){var n=this,i=e;"function"==typeof e&&(i=this.items.filter(function(t,r){return e(t,r)})[0]);var t=!1;if(!Array.isArray(this.items))return Object.keys(this.items).filter(function(t){return!0===r?n.items[t]===i:n.items[t]===Number(i)||n.items[t]===i.toString()})[0]||!1;var o=this.items.filter(function(t){return!0===r?t===i:t===Number(i)||t===i.toString()})[0];return-1!==(t=this.items.indexOf(o))&&t}},function(t,r,e){"use strict";t.exports=function(){if(Array.isArray(this.items))return this.items.shift();var t=Object.keys(this.items)[0],r=this.items[t]||null;return delete this.items[t],r}},function(t,r,e){"use strict";var i=e(0);t.exports=function(){var t=i(this.items),r=void 0,e=void 0,n=void 0;for(n=t.length;n;n-=1)r=Math.floor(Math.random()*n),e=t[n-1],t[n-1]=t[r],t[r]=e;return this.items=t,this}},function(t,r,e){"use strict";t.exports=function(t,r){var e=this.items.slice(t);return void 0!==r&&(e=e.slice(0,r)),new this.constructor(e)}},function(t,r,e){"use strict";t.exports=function(t){var r=[].concat(this.items);return void 0===t?this.every(function(t){return"number"==typeof t})?r.sort(function(t,r){return t-r}):r.sort():r.sort(t),new this.constructor(r)}},function(t,r,e){"use strict";t.exports=function(e){var t=[].concat(this.items);return"function"==typeof e?t.sort(function(t,r){return e(t)<e(r)?-1:e(t)>e(r)?1:0}):t.sort(function(t,r){return t[e]<r[e]?-1:t[e]>r[e]?1:0}),new this.constructor(t)}},function(t,r,e){"use strict";t.exports=function(t){return this.sortBy(t).reverse()}},function(t,r,e){"use strict";t.exports=function(t,r,e){var n=this.slice(t,r);if(this.items=this.diff(n.all()).all(),Array.isArray(e))for(var i=0,o=e.length;i<o;i+=1)this.items.splice(t+i,0,e[i]);return n}},function(t,r,e){"use strict";t.exports=function(t){for(var r=Math.round(this.items.length/t),e=JSON.parse(JSON.stringify(this.items)),n=[],i=0;i<t;i+=1)n.push(new this.constructor(e.splice(0,r)));return new this.constructor(n)}},function(t,r,e){"use strict";t.exports=function(t){var r=0;if(void 0===t)for(var e=0,n=this.items.length;e<n;e+=1)r+=this.items[e];else if("function"==typeof t)for(var i=0,o=this.items.length;i<o;i+=1)r+=t(this.items[i]);else for(var s=0,u=this.items.length;s<u;s+=1)r+=this.items[s][t];return r}},function(t,r,e){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){var r=this;if(Array.isArray(this.items)||"object"!==o(this.items))return t<0?new this.constructor(this.items.slice(t)):new this.constructor(this.items.slice(0,t));var e=Object.keys(this.items),n=void 0;n=t<0?e.slice(t):e.slice(0,t);var i={};return e.forEach(function(t){-1!==n.indexOf(t)&&(i[t]=r.items[t])}),new this.constructor(i)}},function(t,r,e){"use strict";t.exports=function(t){return t(this),this}},function(t,r,e){"use strict";t.exports=function(t,r){for(var e=1;e<=t;e+=1)this.items.push(r(e));return this}},function(t,r,e){"use strict";t.exports=function(){var i=this.constructor;if(Array.isArray(this.items)){var r=[];return this.items.forEach(function(t){!function r(t,e){var n=[];t instanceof i?(t.items.forEach(function(t){return r(t,n)}),e.push(n)):Array.isArray(t)?(t.forEach(function(t){return r(t,n)}),e.push(n)):e.push(t)}(t,r)}),r}return this.values().all()}},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(){return"object"!==n(this.items)||Array.isArray(this.items)?JSON.stringify(this.toArray()):JSON.stringify(this.all())}},function(t,r,e){"use strict";t.exports=function(r){var e=this;if(Array.isArray(this.items))this.items=this.items.map(r);else{var n={};Object.keys(this.items).forEach(function(t){n[t]=r(e.items[t],t)}),this.items=n}return this}},function(t,r,e){"use strict";t.exports=function(t,r,e){t?e(this):r(this)}},function(t,r,e){"use strict";t.exports=function(r){var e=this,n=JSON.parse(JSON.stringify(this.items));return Object.keys(r).forEach(function(t){void 0===e.items[t]&&(n[t]=r[t])}),new this.constructor(n)}},function(t,r,e){"use strict";t.exports=function(t){var r=void 0;if(void 0===t)r=this.items.filter(function(t,r,e){return e.indexOf(t)===r});else{r=[];for(var e=[],n=0,i=this.items.length;n<i;n+=1){var o=void 0;o="function"==typeof t?t(this.items[n]):this.items[n][t],-1===e.indexOf(o)&&(r.push(this.items[n]),e.push(o))}}return new this.constructor(r)}},function(t,r,e){"use strict";t.exports=function(t){return t instanceof this.constructor?t.all():t}},function(t,r,e){"use strict";t.exports=function(){var r=this,e=[];return Object.keys(this.items).forEach(function(t){e.push(r.items[t])}),new this.constructor(e)}},function(t,r,e){"use strict";t.exports=function(t,r,e){return t?r(this,t):e?e(this,t):this}},function(t,r,e){"use strict";var s=e(0),u=e(1);t.exports=function(r,t,e){var n=t,i=e;void 0===e&&(i=t,n="===");var o=s(this.items).filter(function(t){switch(n){case"==":return u(t,r)===Number(i)||u(t,r)===i.toString();default:case"===":return u(t,r)===i;case"!=":case"<>":return u(t,r)!==Number(i)&&u(t,r)!==i.toString();case"!==":return u(t,r)!==i;case"<":return u(t,r)<i;case"<=":return u(t,r)<=i;case">":return u(t,r)>i;case">=":return u(t,r)>=i}});return new this.constructor(o)}},function(t,r,e){"use strict";var i=e(0),o=e(1);t.exports=function(r,t){var e=i(t),n=this.items.filter(function(t){return-1!==e.indexOf(o(t,r))});return new this.constructor(n)}},function(t,r,e){"use strict";var i=e(0),o=e(1);t.exports=function(r,t){var e=i(t),n=this.items.filter(function(t){return-1===e.indexOf(o(t,r))});return new this.constructor(n)}},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){return t instanceof this.constructor?t:"object"===(void 0===t?"undefined":n(t))?new this.constructor(t):new this.constructor([t])}},function(t,r,e){"use strict";t.exports=function(t){var e=this,n=t;n instanceof this.constructor&&(n=n.all());var r=this.items.map(function(t,r){return new e.constructor([t,n[r]])});return new this.constructor(r)}}]); |
@@ -0,1 +1,7 @@ | ||
# 4.2.0 | ||
- Added ``whenEmpty()`` method | ||
- Added ``whenNotEmpty()`` method | ||
- Added ``unlessEmpty()`` method | ||
- Added ``unlessNotEmpty()`` method | ||
# 4.1.0 | ||
@@ -2,0 +8,0 @@ |
@@ -0,1 +1,2 @@ | ||
'use strict'; | ||
@@ -2,0 +3,0 @@ |
@@ -95,2 +95,4 @@ 'use strict'; | ||
Collection.prototype.unless = require('./methods/unless'); | ||
Collection.prototype.unlessEmpty = require('./methods/whenNotEmpty'); | ||
Collection.prototype.unlessNotEmpty = require('./methods/whenEmpty'); | ||
Collection.prototype.union = require('./methods/union'); | ||
@@ -101,2 +103,4 @@ Collection.prototype.unique = require('./methods/unique'); | ||
Collection.prototype.when = require('./methods/when'); | ||
Collection.prototype.whenEmpty = require('./methods/whenEmpty'); | ||
Collection.prototype.whenNotEmpty = require('./methods/whenNotEmpty'); | ||
Collection.prototype.where = require('./methods/where'); | ||
@@ -103,0 +107,0 @@ Collection.prototype.whereIn = require('./methods/whereIn'); |
{ | ||
"name": "collect.js", | ||
"version": "4.1.0", | ||
"version": "4.2.1", | ||
"description": "Convenient and dependency free wrapper for working with arrays and objects.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -121,5 +121,9 @@ # <img src="https://raw.githubusercontent.com/ecrmnn/collect.js/master/collectjs.jpg" alt="collect.js"> | ||
- [unless](#unless) | ||
- [unlessEmpty](#unlessEmpty) | ||
- [unlessNotEmpty](#unlessNotEmpty) | ||
- [unwrap](#unwrap) | ||
- [values](#values) | ||
- [when](#when) | ||
- [whenEmpty](#whenEmpty) | ||
- [whenNotEmpty](#whenNotEmpty) | ||
- [where](#where) | ||
@@ -1950,2 +1954,8 @@ - [whereIn](#wherein) | ||
#### ``unlessEmpty()`` | ||
Alias for the [``whenNotEmpty()``](#whenNotEmpty) method | ||
#### ``unlessNotEmpty()`` | ||
Alias for the [``whenEmpty()``](#whenEmpty) method | ||
#### ``unwrap()`` | ||
@@ -1990,2 +2000,61 @@ The unwrap method will unwrap the given collection: | ||
#### ``whenEmpty()`` | ||
The ``whenEmpty`` method will execute the given callback when the collection is empty: | ||
```js | ||
const collection = collect([]); | ||
collection.whenEmpty(c => c.push('Mohamed Salah')); | ||
collection.all(); | ||
//=> ['Mohamed Salah'] | ||
``` | ||
```js | ||
const collection = collect([ | ||
'Sadio Mané', | ||
]); | ||
collection.whenEmpty(c => c.push('Mohamed Salah'), c => c.push('Xherdan Shaqiri')); | ||
collection.all(); | ||
//=> [ | ||
//=> 'Sadio Mané', | ||
//=> 'Xherdan Shaqiri', | ||
//=> ]; | ||
``` | ||
#### ``whenNotEmpty()`` | ||
The ``whenNotEmpty`` method will execute the given callback when the collection is not empty: | ||
```js | ||
const collection = collect([ | ||
'Sadio Mané', | ||
]); | ||
collection.whenNotEmpty(c => c.push('Mohamed Salah')); | ||
collection.all(); | ||
//=> [ | ||
//=> 'Sadio Mané', | ||
//=> 'Mohamed Salah', | ||
//=> ] | ||
``` | ||
```js | ||
const collection = collect([ | ||
'Sadio Mané', | ||
]); | ||
collection.whenNotEmpty(c => c.push('Mohamed Salah'), c => c.push('Xherdan Shaqiri')); | ||
collection.all(); | ||
//=> [ | ||
//=> 'Sadio Mané', | ||
//=> 'Mohamed Salah', | ||
//=> ]; | ||
``` | ||
#### ``where()`` | ||
@@ -1992,0 +2061,0 @@ The where method filters the collection by a given key / value pair: |
@@ -0,1 +1,2 @@ | ||
'use strict'; | ||
@@ -2,0 +3,0 @@ |
@@ -95,2 +95,4 @@ 'use strict'; | ||
Collection.prototype.unless = require('./methods/unless'); | ||
Collection.prototype.unlessEmpty = require('./methods/whenNotEmpty'); | ||
Collection.prototype.unlessNotEmpty = require('./methods/whenEmpty'); | ||
Collection.prototype.union = require('./methods/union'); | ||
@@ -101,2 +103,4 @@ Collection.prototype.unique = require('./methods/unique'); | ||
Collection.prototype.when = require('./methods/when'); | ||
Collection.prototype.whenEmpty = require('./methods/whenEmpty'); | ||
Collection.prototype.whenNotEmpty = require('./methods/whenNotEmpty'); | ||
Collection.prototype.where = require('./methods/where'); | ||
@@ -103,0 +107,0 @@ Collection.prototype.whereIn = require('./methods/whereIn'); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
386389
210
5498
2208