I put together a collection of JavaScript stuff I use. Hope you find them useful! These are the collection of some handful javascript snippets
Use this:
npm install @zellwk/javascript
Then import whatever utilities you need. it's completely open source
-
Browsers only
- After Polyfill
- Before Polyfill
- focusable - Finds focusable elements
- getSiblingElements - Get sibling elements
- getTranslateValues - Get 2d and 3d CSS Translate values
- normaliseButton - resolves button inconsistencies
- setConnectionStatus - Updates HTML when connection status changes
- store
- tab - Helpers for normal Tab key vs Shift + Tab
- trapFocus - traps focus
-
Everywhere
- Convert Case - helpers for case covversion
- generateUniqueString - Generates a unique string
- mix - Merges objects (including accessors)
- wait - Delay before resolving a promise
This repository is always a Work in Progress. I may change any suggestion are welcomed