df3482f3c2 | ||
---|---|---|
.github | ||
config | ||
docs/api | ||
scripts | ||
src | ||
test | ||
vendor/rollup-resources | ||
.codeclimate.yml | ||
.dockerignore | ||
.gitignore | ||
.gitlab-ci.yml | ||
.npmignore | ||
.npmrc | ||
CHANGELOG.md | ||
Dockerfile.alpine | ||
Dockerfile.stretch | ||
LICENSE.md | ||
Makefile | ||
README.md | ||
package.json | ||
renovate.json | ||
run.mk | ||
tsconfig.json | ||
yarn.lock |
README.md
JS Utils
This project is a collection of utilities meant to extend lodash, collected from my other Typescript projects, lightly documented, and heavily tested.
Contents
Status
Releases
Usage
Install:
yarn add -D @apextoaster/js-utils
And import:
import { mustExist } from '@apextoaster/js-utils';
The library is bundled and depends on lodash, linked in a vendor module.
Features
- array mapper
- map elements to keys by order
- skip initial, gather remaining
- async
- defer
- promise timeout
- wait for predicate
- async tracker
- track and log leaking async resources for tests
- buffer
- checklist
- include/exclude mode (whitelist/blacklist)
- child process
- wait for exit and gather output
- write and flush
- env
- check
DEBUG
- check
- list
- concat lists
- logger
- get test logger (null or console depending on
DEBUG
)
- get test logger (null or console depending on
- map
- must get (assertion)
- get or default
- get head from list value
- get head or default
- set or push to key
- merge maps
- push-merge maps
- convert dict to map and vice versa
- normalize map values to lists
- create map from name-value pairs
- maybe
- is nil test (negative nil test)
- count array or maybe
- filter nil from list
- must find (assertion)
- does exist (positive nil test)
- must exist (assertion)
- must default (assertion)
- pid file
- write pid file
- delete pid file
- reflect
- get constructor name
- get methods from prototype chain
- signals
- wait for OS signal
- string
- left pad (please don't import just for this)
- trim with suffix