6 ms·
Some utility stuff I copy paste between projects: - range, clamp, inIvl, enumerate, topK - groupBy (array to record), numeric / lexical array sorts - see
by Frotag 6mo ago
Some utility stuff I copy paste between projects:
- range, clamp, inIvl, enumerate, topK
- groupBy (array to record), numeric / lexical array sorts
- seeded rng
- throttling
- attachDragListener (like d3's mousedown -> mousemove -> mouseup)
- Maps / Sets that accept non-primitive keys (ie custom hash)
So basically functions that every *dash variant includes.
- spartanatreyu 6mo agoAlso, all the functions that are already in the standard library but are made in a way that don't use more modern features: - Functions that use map-like and set-like objects instead of maps and sets. - Functions that should be async that aren't - Async functions that should be cancellable, but aren't - Functions that should use the disposable and async disposable stack (e.g. the `using` keyword) - Functions that should return deeply immutable data structures but can't. (The R̶e̶c̶o̶r̶d̶s̶ ̶a̶n̶d̶ ̶T̶u̶p̶l̶e̶s̶ / Composites, and Structs proposals would help here) - Concurrency coordination primitives (Imagine an array of 10 async functions that we wish to run. Going through them one at a time is too slow. `Promise.allSettled()` executes them all at the same time which might slow things down even more due to bottlenecking. We should have an easy way to say only execute a maximum of 3 at a time. As 1 function resolves, the next one is started, until all are resolved).