EasyImages2.0/public/static/zui/lib/array/zui.array.min.js

7 lines
2.8 KiB
JavaScript

/*!
* ZUI: 数组辅助方法 - v1.9.2 - 2020-07-09
* http://openzui.com
* GitHub: https://github.com/easysoft/zui.git
* Copyright (c) 2020 cnezsoft.com; Licensed MIT
*/
!function(){"use strict";var r="function";Array.prototype.forEach||(Array.prototype.forEach=function(t){var o=this.length;if(typeof t!=r)throw new TypeError;for(var e=arguments[1],n=0;n<o;n++)n in this&&t.call(e,this[n],n,this)}),Array.isArray||(Array.isArray=function(r){return"[object Array]"===Object.toString.call(r)}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(r){var t=this.length,o=Number(arguments[1]);for(isNaN(o)?o=t-1:(o=o<0?Math.ceil(o):Math.floor(o),o<0?o+=t:o>=t&&(o=t-1));o>-1;o--)if(o in this&&this[o]===r)return o;return-1}),Array.prototype.every||(Array.prototype.every=function(t){var o=this.length;if(typeof t!=r)throw new TypeError;for(var e=arguments[1],n=0;n<o;n++)if(n in this&&!t.call(e,this[n],n,this))return!1;return!0}),Array.prototype.filter||(Array.prototype.filter=function(t){var o=this.length;if(typeof t!=r)throw new TypeError;for(var e=[],n=arguments[1],i=0;i<o;i++)if(i in this){var a=this[i];t.call(n,a,i,this)&&e.push(a)}return e}),Array.prototype.indexOf||(Array.prototype.indexOf=function(r){var t=this.length,o=Number(arguments[1])||0;for(o=o<0?Math.ceil(o):Math.floor(o),o<0&&(o+=t);o<t;o++)if(o in this&&this[o]===r)return o;return-1}),Array.prototype.map||(Array.prototype.map=function(t){var o=this.length;if(typeof t!=r)throw new TypeError;for(var e=new Array(o),n=arguments[1],i=0;i<o;i++)i in this&&(e[i]=t.call(n,this[i],i,this));return e}),Array.prototype.where||(Array.prototype.where=function(t,o){o=o||[];var e,n,i;return this.forEach(function(a){n=!0;for(var f in t)if(e=t[f],typeof e===r?n=e(a):(i=a[f],n=i&&i===e),!n)break;n&&o.push(a)}),o}),Array.prototype.groupBy||(Array.prototype.groupBy=function(r){var t={};return this.forEach(function(o){var e=o[r];e||(e="unkown"),t[e]||(t[e]=[]),t[e].push(o)}),t}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(r){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),o=t.length>>>0;if("function"!=typeof r)throw new TypeError("predicate must be a function");for(var e=arguments[1],n=0;n<o;){var i=t[n];if(r.call(e,i,n,t))return i;n++}}}),Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(r){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),o=t.length>>>0;if("function"!=typeof r)throw new TypeError("predicate must be a function");for(var e=arguments[1],n=0;n<o;){var i=t[n];if(r.call(e,i,n,t))return n;n++}return-1}}),Array.prototype.has||(Array.prototype.has=function(t){var o,e,n,i=!1;return this.forEach(function(a){e=!0;for(var f in t)if(o=t[f],typeof o===r?e=o(a):(n=a[f],e=n&&n===o),!e)break;if(e)return i=!0,!1}),i})}();