@apextoaster/js-utils
v0.5.0
Published
utility functions
Downloads
73
Readme
JS Utils
This project is a collection of utilities, 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 has no dependencies.
Features
Please see the complete API docs for the full function list.
Features utilities and helpers for:
- Array
- assertions/guards:
hasItems
isArray
for bothArray
/ReadonlyArray
isEmpty
lengthOf
- conversion
filterZip
toArray
- assertions/guards:
- Array Mapper
- array-to-map converter, reduces an array of values to a map, using an array of keys
- Async
- timed promises
defer
/deferValue
deferUntil
timeout
- timed promises
- Buffer
- concatenation
concat
encode
- concatenation
- Checklist
- allow/deny list
- Child Process
childResult
writeInput
- Env Vars
isDebug
- Errors
- nestable, typed error
ChildProcessError
InvalidArgumentError
MissingKeyError
NotFoundError
NotImplementedError
TimeoutError
- nestable, typed error
- Logger
- test logging helpers
- Map
- types
MapLike
- assertions/guards:
mustGet
- null-safe helpers
getOrDefault
- helpers for
Map<K, Array<V>>
getHead
/getHeadOrDefault
setOrPush
- concat/merge
mergeMap
pushMergeMap
- conversion
entriesOf
makeDict
makeMap
pairsToMap
- types
- Math
- predicates for functional methods
sum
- predicates for functional methods
- Maybe
- types
Maybe
None
- assertions/guards
doesExist
mustExist
mustDefault
mustFind
removeNone
- null-safe helpers
isNone
isSome
- types
- Predicate
- types for functional methods
- Reflect
getConstructor
getMethods
- Signal
- wait for OS signal
signal
- wait for OS signal
- String
leftPad
trim
with suffix