pixiu-number-toolkit
Version:
A collection of number utilities.
5 lines (4 loc) • 435 B
JavaScript
function u(n){let a=n.sort((e,r)=>e.start-r.start);return {breakpoints:a.map(e=>e.start),values:a.map(e=>e.value)}}function i(n,a){let{breakpoints:e,values:r}=a,l=0,s=e.length-1;if(n<e[0])return null;for(;l<=s;){let t=Math.floor((l+s)/2);if(n>=e[t]){if(t===e.length-1||n<e[t+1])return r[t];l=t+1;}else s=t-1;}return null}
export { u as a, i as b };
//# sourceMappingURL=chunk-VCO3L6GO.js.map
//# sourceMappingURL=chunk-VCO3L6GO.js.map