cat handyscript.js
08 / 19
handyscript
Everyday JavaScript helpers: arrays with sort algorithms, matrices, math, strings, JSON.
- role
- javascript engineer, main author
- year
- 2023
- access
- -rwxr-xr-x (open source)
- problem
- The helpers I kept rewriting: chunk an array, shuffle it, a random integer, a sort I could pick.
- approach
- Put them on the built-ins, test each module with Jest, ship to npm and both CDNs from CI.
- outcome
- Versions 1.0 to 1.9 in 2023, written with @tchisama and @ilorez, and used in my own client work.
TL;DR
// overview
Ships to npm and both CDNs with Jest in CI. Siblings: handyutility, and dhom, which binds data to HTML through attributes.
// from handy.js to handyscript
It started in May 2023 as @handy.js/handy, "a javascript library for dummies". A month later it was renamed and rebuilt as its own organization, with docs, CI and semantic releases.
// sorting, by hand
Ten sort algorithms, from bubble to radix and shell, each implemented and tested, and binarySearch takes the one to sort with.
// the family
handyutility gathers the helpers that didn't fit, and DHOM binds data to HTML through attributes: data, loop, in and of. Cactusia imported handyscript; leorodney ran on its predecessor.
// stack
- javascript
- jest
- nuxt (docs)