@wizhut_tech/wizjs
v0.2.1
Published
Simple but useful hacks for everyday javascript programming
Maintainers
Readme
Wizjs
A Javascript library that ports selected Python idioms and stdlib helpers (itertools, functools, collections) to everyday JS. A few selected dependencies only. No, this library will not become another lodash :).
Use by importing the area you need:
const { isNil } = require('@wizhut_tech/wizjs/lang/checks');
const { Counter } = require('@wizhut_tech/wizjs/lang/collections');
const { clamp } = require('@wizhut_tech/wizjs/math/numbers');Every area listed below is reachable as @wizhut_tech/wizjs/<namespace>/<area>.
The subpath form needs Node 14.13 or newer.
The whole library is also available from a single root import --
const wizjs = require('@wizhut_tech/wizjs') -- which returns an object
structured like:
{
io: {
files: [functions]
},
lang: {
arrays: [functions],
checks: [functions],
flow: [functions],
singleton: [functions],
functools: [functions],
itertools: [functions],
objects: [functions],
collections: [functions]
},
math: {
numbers: [functions]
},
exceptions: {
BadlyInitializedError
}
}Individual functions can be destructured out of that as well, though it nests three levels deep:
const { lang: { checks : { isNil } } } = require('@wizhut_tech/wizjs');
Both forms hand back the same objects, so they mix freely. Library internals
(under src/internal/) are deliberately not reachable as subpaths --
BadlyInitializedError is re-exported from the root import instead.
I/O
- Files utility functions ... [docs]
Language
- Arrays utility functions ... [docs]
- Check utility functions ... [docs]
- Control-Flow utilities ... [docs]
- functools ... [docs]
- itertools ... [docs]
- Objects utility functions ... [docs]
- collections (
Counter,DefaultDict) ... [docs] - Singleton hack ... [docs]
Math
- Utilities around numbers ... [docs]
Contact
This library is actively developed and maintained by wizhut.tech
