lutils
✓ TypesSript documented
- merge for deep merging of objects
- clone for deep cloning of objects & arrays
- typeOf for consistant type checking
- See: CHANGELOG.md
merge
Merge objects together, traversing objects & arrays recursively
merge(subject, ...sources[])
=>subject
- Default depth:
10
merge, , ===
Construct & configure your own Merge
instance
new Merge(config).merge
- See: config
mergemegaDeep, ultraDeep
Merge, but with two common behaviours, whitelisting and blacklisting
merge.white(subject, ...sources[])
=>subject
merge.black(subject, ...sources[])
=>subject
merge.white, === merge.black, ===
clone
Clones objects & arrays recursively
clone(subject)
=>clonedSubject
- Default depth:
10
new Clone(config).clone
- See: config
typeOf
Gets the type of a value as a lowercase string.
Like the built-in typeof
, but works for all primitives.
typeOf(value)
=>string
typeOfnull=== 'null' typeOfNaN=== 'nan' typeOf=== 'array'
Specific type checkers are also exported and attached to typeOf
These checkers also supply typescript with type information, meaning
they can act a type guards.
isBoolean(value)
=>boolean
is<type>(value)
=>boolean
- See: ITypeOf
typeOf.isNullnull=== true isStringundefined=== false typeOf.isString''=== true isBooleanfalse=== true // Type guarding...