push-if

![npm](https://img.shields.io/npm/v/push-if.svg) ![npm](https://img.shields.io/npm/dm/push-if.svg) [![CircleCI](https://circleci.com/gh/djyde/push-if.svg?style=svg)](https://circleci.com/gh/djyde/push-if)

Usage no npm install needed!

<script type="module">
  import pushIf from 'https://cdn.skypack.dev/push-if';
</script>

README

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