@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 1.7 kB
JavaScript
const e=e=>typeof e==`object`&&!!e&&!Array.isArray(e),t=n=>{try{return structuredClone(n)}catch{return Array.isArray(n)?n.map(e=>t(e)):e(n)?Object.fromEntries(Object.entries(n).map(([e,n])=>[e,t(n)])):n}},n=(t,r,i=[])=>{if(r.length===0)return[i];let[a,...o]=r;return a?a.type===`key`?!e(t)||!Object.hasOwn(t,a.key)?[]:n(t[a.key],o,[...i,a.key]):a.type===`index`?!Array.isArray(t)||a.index>=t.length?[]:n(t[a.index],o,[...i,a.index]):Array.isArray(t)?t.flatMap((e,t)=>n(e,o,[...i,t])):[]:[i]},r=(t,n)=>{let r=t;for(let t of n){if(typeof t==`number`){if(!Array.isArray(r))return;r=r[t];continue}if(!e(r))return;r=r[t]}return r},i=(t,n,r,i)=>{if(n.length===0)return;let a=t;for(let t=0;t<n.length-1;t++){let r=n[t];if(r===void 0)return;let o=n[t+1];if(typeof r==`number`){if(!Array.isArray(a))return;a[r]===void 0&&i?.createMissing&&(a[r]=typeof o==`number`?[]:{}),a=a[r];continue}if(!e(a))return;a[r]===void 0&&i?.createMissing&&(a[r]=typeof o==`number`?[]:{}),a=a[r]}let o=n[n.length-1];if(o!==void 0){if(typeof o==`number`){if(!Array.isArray(a))return;a[o]=r;return}e(a)&&(a[o]=r)}},a=(t,n)=>{if(n.length===0)return;let r=t;for(let t=0;t<n.length-1;t++){let i=n[t];if(i===void 0)return;if(typeof i==`number`){if(!Array.isArray(r))return;r=r[i];continue}if(!e(r))return;r=r[i]}let i=n[n.length-1];if(i!==void 0){if(typeof i==`number`){if(!Array.isArray(r))return;r[i]=null;return}e(r)&&delete r[i]}},o=e=>e.map(e=>e.type===`key`?e.key:e.type===`index`?e.index:0);export{t as cloneValue,o as emailStorageSegmentsToPath,r as getValueAtEmailStoragePath,e as isRecord,a as removeValueAtEmailStoragePath,n as resolveExistingEmailStoragePaths,i as setValueAtEmailStoragePath};
//# sourceMappingURL=paths.mjs.map