UNPKG

remeda

Version:

A utility library for JavaScript and Typescript.

2 lines (1 loc) 330 B
import{a as i}from"./chunk-WIMGWYZL.js";function p(...e){return i(l,e)}function l(e,t){if(t<=0)return[];if(t>=e.length)return[...e];let u=Math.min(t,e.length-t),n=new Set;for(;n.size<u;){let r=Math.floor(Math.random()*e.length);n.add(r)}return t===u?[...n].sort((r,a)=>r-a).map(r=>e[r]):e.filter((r,a)=>!n.has(a))}export{p as a};