array-append-until

Add one element to the end of an array returning the new array without mutating source array.

Usage no npm install needed!

<script type="module">
  import arrayAppendUntil from 'https://cdn.skypack.dev/array-append-until';
</script>

README

array-append-until

Add one element to the end of an array returning the new array without mutating source array.

Build Status Code Climate js-standard-style

npm install array-append-until --save

You can also use Duo, Bower or download the files manually.

npm stats

npm NPM downloads Dependency Status

API Example

Static
var appendUntil = require('array-append-until')
appendUntil('Z', (list) => list.length === 2)
//=> ['Z', 'Z']
Generator
var appendUntil = require('array-append-until')
appendUntil((list) => list.pop() + 5, (list) => list.length === 3, [0])
//=> [ 0, 5, 10 ]

API

appendUntil(element, predicate, list)

arguments
  • element (*|Function).
  • predicate (Function).
  • list (Array).
returns
  • (Array) New array with element (or value returned from applying list to element function) appended.

Alternatives

  • N/A

Contributing

SEE: contributing.md

Licenses

GitHub license