remeda
Version:
A utility library for JavaScript and Typescript.
2 lines • 756 B
JavaScript
const e={asc:(e,t)=>e>t,desc:(e,t)=>e<t};function t(e,t){let[n,...a]=t;if(!i(n)){let t=r(...a);return e(n,t)}let o=r(n,...a);return t=>e(t,o)}function n(e,[n,r,...a]){let o,s;return i(r)?(o=n,s=[r,...a]):(o=r,s=[n,...a]),t((...t)=>e(...t,o),s)}function r(t,n,...i){let a=typeof t==`function`?t:t[0],o=typeof t==`function`?`asc`:t[1],{[o]:s}=e,c=n===void 0?void 0:r(n,...i);return(e,t)=>{let n=a(e),r=a(t);return s(n,r)?1:s(r,n)?-1:c?.(e,t)??0}}function i(t){if(a(t))return!0;if(typeof t!=`object`||!Array.isArray(t))return!1;let[n,r,...i]=t;return a(n)&&typeof r==`string`&&r in e&&i.length===0}const a=e=>typeof e==`function`&&e.length===1;export{t as purryOrderRules,n as purryOrderRulesWithArgument};
//# sourceMappingURL=purryOrderRules-CfRtTEyM.js.map