6 lines
10 KiB
JavaScript
6 lines
10 KiB
JavaScript
|
/*!
|
||
|
* Part of LiteRyzJS v0.1.0.424
|
||
|
* Copyright 2023-2024 Ray Lam (https://www.hiimray.co.uk)
|
||
|
*
|
||
|
*/
|
||
|
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.LiteRyzJS=e():t.LiteRyzJS=e()}(this,(()=>(()=>{var t={814:()=>{Array.isEmpty=function(t){return"array"!=Object.getDataType(t)||t.length<=0},Array.toFlatten=function(t,e,r){for(let n=0;n<t.length;n++)r.push(t[n]),null!=typeof t[n][e]&&t[n][e].length>0&&Array.toFlatten(t[n][e],e,r)},Array.prototype.addRange=function(t){return null==t||t.forEach((t=>{this.push(t)})),this},Array.prototype.all=function(t,e){for(let r=0;r<this.length;r++)if(null==t){if(this[r]!=e)return!1}else if(void 0!==this[r][t]&&this[r][t]!=e)return!1;return!0},Array.prototype.any=function(t,e){for(let r=0;r<this.length;r++)if(null==t){if(this[r]==e)return!0}else if(void 0!==this[r][t]&&this[r][t]==e)return!0;return!1},Array.prototype.copy=function(){return JSON.parse(JSON.stringify(this))},Array.prototype.count=function(t,e){let r=0;for(let n=0;n<this.length;n++)null==t?this[n]==e&&r++:void 0!==this[n][t]&&this[n][t]==e&&r++;return r},Array.prototype.countMany=function(...t){let e=0;return t.forEach((t=>{e+=this.count(t.propName,t.value)})),e},Array.prototype.create=function(t,e){let r=[];for(let n=0;n<t;n++)r.push(e);return r},Array.prototype.distinct=function(){return this.filter(((t,e,r)=>e===r.findIndex((e=>JSON.stringify(e)===JSON.stringify(t)))))},Array.prototype.flatten=function(t){let e=[];return Array.toFlatten(this,t,e),e},Array.prototype.get=function(t){return t<0||t>=this.length?"":this[t]},Array.prototype.index=function(t,e){const r=this.indexes(t,e);return r.length<=0?null:r[0]},Array.prototype.indexes=function(t,e){let r=[];for(let n=0;n<this.length;n++)null==t?this[n]==e&&r.push(n):void 0!==this[n][t]&&this[n][t]==e&&r.push(n);return r},Array.prototype.insert=function(t,e){return t<0?this.splice(0,0,e):t>=this.length?this.push(e):this.splice(t,0,e),this},Array.prototype.joinIfNotNullOrWhitespace=function(t){let e="";for(let r=0;r<this.length;r++)String.isNullOrWhitespace(this[r])||(String.isNullOrWhitespace(e)||(e+=t),e+=this[r]);return e},Array.prototype.first=function(t,e){for(let r=0;r<this.length;r++)if(void 0!==this[r][t]&&this[r][t]==e)return this[r];return null},Array.prototype.forEachTree=function(t,e){for(let r=0;r<this.length;r++){if(!1===e(this[r]))return;if(!(this[r][t].length<=0)&&!1===this[r][t].forEachTree(t,e))return}},Array.prototype.orderBy=function(t){return this.sort((function(e,r){return e[t]<r[t]?-1:e[t]>r[t]?1:0})),this},Array.prototype.orderByDesc=function(t){return this.sort((function(e,r){return e[t]<r[t]?1:e[t]>r[t]?-1:0})),this},Array.prototype.remove=function(t){let e=[];for(let r=0;r<this.length;r++)this[r]==t&&e.push(r);for(let t=e.length-1;t>=0;t--)this.removeAt(e[t]);return this},Array.prototype.removeAt=function(t){return t<0||t>=this.length||this.splice(t,1),this},Array.prototype.removeRange=function(t){for(let e=0;e<t.length;e++)this.remove(t[e]);return this},Array.prototype.notSelect=function(t,e){let r=[];for(let n=0;n<this.length;n++)void 0!==this[n][t]&&this[n][t]!=e&&r.push(this[n]);return r},Array.prototype.select=function(t,e){let r=[];for(let n=0;n<this.length;n++)void 0!==this[n][t]&&this[n][t]==e&&r.push(this[n]);return r},Array.prototype.selectMany=function(...t){let e=this;return t.forEach((t=>{e=e.select(t.propName,t.value)})),e},Array.prototype.toList=function(t){let e=[];return this.forEach((r=>{null!=typeof r[t]&&e.push(r[t])})),e},Array.prototype.sortTree=function(t,e){this.orderBy(e);for(let r=0;r<this.length;r++)this[r][t].length<=0||this[r][t].orderBy(e)}},523:()=>{Boolean.isFalse=function(t){return!!String.isNullOrUndefined(t)||t.toString().containsCI("false","f","y","0","x")},Boolean.isTrue=function(t){return!String.isNullOrUndefined(t)&&t.toString().containsCI("true","t","n","1","o")},Boolean.ifTrue=function(t,e,r){return Boolean.isTrue(t)?e:r}},579:()=>{Date.addDays=function(t,e){let r=new Date(t);return r.addDays(e),r},Date.addMonths=function(t,e){let r=new Date(t);return r.addMonths(e),r},Date.addYears=function(
|