robot1d59cc305 / push-if

push element to the array if true

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

push-if

npm npm CircleCI

Push a element to the array if true.

Installation

npm i push-if

Usage

import 'push-if'

const arr = ['a', 'b', 'c']

arr
  .pushIf(true, 'd') // => arr becomes ['a', 'b', 'c', 'd']
  .pushIf(false, 'f') // => arr will not change

pushIf() will return the current array

License

MIT License

About

push element to the array if true


Languages

Language:JavaScript 100.0%