PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.5.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.5.5
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
fluent-cart / assets / chunks / Arr.js

Arr.js in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.5.5, at assets/chunks/Arr.js

2 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 class l{static set(i,n,r){const e=n.split(".");let t=i;for(;e.length>1;){const s=e.shift();t[s]||(t[s]={}),t=t[s]}t[e[0]]=r}static get(i,n,r=null){if(!n)return r;if(!(n||Array.isArray(i)||typeof i=="object"))return i;const e=n.trim().split(".");if(n.includes("*"))return l._getWithWildcard(i,e,r);let t=i;for(const s of e){if(!t||!t.hasOwnProperty(s))return r;t=t[s]}return t}static _getWithWildcard(i,n,r=null){let e=i;for(let t=0;t<n.length;t++){const s=n[t];if(s==="*")if(Array.isArray(e)){const c=n.slice(t+1).join(".");return c?e.map(o=>l.get(o,c,r)):e}else if(typeof e=="object"&&e!==null){const c=n.slice(t+1).join(".");return c?Object.values(e).map(o=>l.get(o,c,r)):Object.values(e)}else return r;else{if(!e||!e.hasOwnProperty(s))return r;e=e[s]}}return e}static resolvePath(i,n){if(!(i.includes(".")||n.includes(".")))return n;let r=i.split(".");r.pop();let e=n.split("../"),t=e.pop(),s=0,c="";for(let o=0;o<e.length;o++)e[o]===""&&s++;return r.splice(0,s),c=r.length?r.join(".")+".":"",c+`${t}`}static getByPath(i,n,r,e){const t=l.resolvePath(n,r);return l.get(i,t,e)}static whereIn(i,n,r){return!Array.isArray(i)||!Array.isArray(r)?[]:i.filter(e=>{if(typeof e=="object"&&e!==null){const t=l.get(e,n);return r.includes(t)}return r.includes(e)})}static where(i,n,r){return Array.isArray(i)?i.filter(e=>typeof e=="object"&&e!==null?l.get(e,n)===r:e===r):[]}static sum(i,n=""){if(n.includes("*")){const r=l.get(i,n,[]);return Array.isArray(r)?r.reduce((e,t)=>e+(typeof t=="number"?t:0),0):0}return i.reduce((r,e)=>{const t=typeof e=="object"&&e!==null?l.get(e,n,0):e;return r+(typeof t=="number"?t:0)},0)}}export{l as A};
2