insert-into-if

Conditionally add elements to object/array


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

Documentation

Utils for insert elements in array/object.

Array

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

Object

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