insert-into-if

Conditionally add elements to object/array


Keywords
conditionally, insert, object, array
License
ISC
Install
npm install insert-into-if@1.0.0

Documentation

Utils for insert elements in array/object.

Array

[
    ...,
    ...insertIf(condition, element),
    ...,
]

Object

{
...,
...insertIf(condition, {key: value}),
...,
}