WizJS

Curated JavaScript utilities — without the lodash bloat

A practical, opinionated toolbox of helpers we actually reach for in production — Python's itertools, functools, and collections ported to JS: 19 lazy generators, memoize and partial, Counter and DefaultDict. Every area is its own package subpath, so you can require lang/checks on its own and leave the rest behind. Zero runtime dependencies, working across Node, the browser, and edge runtimes.

npm install @wizhut_tech/wizjs
Library · Node · Browser · Edge

One library, organised by what you're trying to do.

Helpers live under namespaces — lang, io, math — so the right tool is wherever your fingers expect it. Each area is also a package subpath, so the import path and the docs page are the same address.

Pull in everything

The root import still hands back the whole nested object — handy at the REPL, or in scripts where one require is simpler.

const wizjs = require('@wizhut_tech/wizjs')

wizjs.lang.checks.isNil(undefined)         // → true
wizjs.lang.checks.isObject({ a: 1 })       // → true
wizjs.math.numbers.clamp(42, 0, 10)        // → 10

New — import just the area you need

Every namespace area answers to its own subpath, so nothing else is loaded. Needs Node 14.13 or newer.

const { isNil, isEmpty } =
  require('@wizhut_tech/wizjs/lang/checks')
const { clamp } =
  require('@wizhut_tech/wizjs/math/numbers')

// …/<namespace>/<area> — nothing else is loaded
if (isNil(value) || isEmpty(value)) {
  return defaultValue
}

clamp(value, 0, 10)

Lazy iteration

itertools mirrors the Python primitives we all miss — 19 lazy generators.

const itertools =
  require('@wizhut_tech/wizjs/lang/itertools')

const pairs =
  [...itertools.zip(['a', 'b', 'c'], [1, 2, 3])]
// → [['a', 1], ['b', 2], ['c', 3]]

const batches =
  [...itertools.batched([1, 2, 3, 4, 5], 2)]
// → [[1, 2], [3, 4], [5]]

Functional composition

functools for compose, partial, once, memoize.

const { compose } =
  require('@wizhut_tech/wizjs/lang/functools')

// composes right to left, like Python
const slugify = compose(
  s => s.replace(/\s+/g, '-'),
  s => s.trim(),
  s => s.toLowerCase()
)

slugify('  Hello World  ')   // → 'hello-world'

Python's collections, and object helpers

Counter and DefaultDict straight from Python, joined by pick, omit, and get.

const { Counter } = require('@wizhut_tech/wizjs/lang/collections')
const objects = require('@wizhut_tech/wizjs/lang/objects')

const tally = new Counter(['js', 'py', 'js', 'go', 'js'])
tally.mostCommon(2)   // → [['js', 3], ['py', 1]]
tally.get('rb')       // → 0 — unseen simply counts as zero

objects.pick({ id: 7, name: 'Ada', password: '…' }, ['id', 'name'])
// → { id: 7, name: 'Ada' }

Ten focused namespaces

Only the helpers that carry their weight

Practical helpers, drawn from real production codebases — and only the ones that actually carry their weight.

io.files

Small file helpers — loadFully reads a whole file in one call, no fs boilerplate.

lang.arrays

Practical array operations beyond the standard prototype — chunk, unique, flatten, compact, and accumulate for folding with named operators.

lang.checks

Type-safe predicates: isNil, isEmpty, isString, isObject, isInteger and friends. Drop-in replacements for the lodash predicates you actually use.

lang.flow

Control-flow helpers — if_exception runs a function and hands back your fallback when it throws.

lang.singleton

The singleton pattern done right — register an instance once, getInstance anywhere.

lang.functools

Python's functools in JS — partial, compose, once, memoize (with a cache alias), and reduce.

lang.itertools

Python's itertools as 19 lazy generators — chain, zip, range, enumerate, islice, groupby, product, batched, pairwise, and more. Works on any iterable.

lang.objects

pick, omit, and path-safe get — the three object helpers every codebase ends up writing.

lang.collections

The Python collections JS is missing — Counter with mostCommon and elements, and DefaultDict with a filling factory.

math.numbers

Numeric utilities — clamp, true modulo, and the safe coercions toInteger and toNumber.

Open source

Ready to drop in

Free, open source, and zero runtime dependencies — built to span Node, browsers, and edge runtimes. No magic, no surprises.