npm

Join us for the "JavaScript Supply Chain Security" tech talk, presented by VP of Security, Adam Baldwin. 6/20 at 10am PT.Sign up here »

array.onempty

1.4.0 • Public • Published

array.onempty(fn)

Enable call of callback function to empty arrays

Simple example:

<script type="txt/javascript src="/path/to/libs/array.onempty.js" ></script>

||

require('array.onempty);

and then

[1,2,3,4,5].map(function(item) {return item > 10 }) //this should return an empty list
.onEmpty(function() {
   console.log('Ey! This is an empty list');
});


[].onEmpty(function(empty) {
  empty.push(1) //returning an array : [1]
 }).onEmpty(function() {
     //now this won't be invoked
 });

Build code

npm install

Test code

npm test

Publish

npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]

git push --follow-tags

npm publish

install

npm i array.onempty

Downloadsweekly downloads

6

version

1.4.0

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability