Skip to content

pirfalt/scaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

scaner

Stateful function. Almost like reduce, but for repeated calls to a function instead of elements in a list.

Example

var scaner = require('scaner')

var clickCounter = scaner(0, function (accumilator, current) {
  // Do something with the event (current) that may depend on returned state form last call
  return accumilator + 1
})

document.body.addEventListener('click', clickCounter, false)

To think about

If your accumilator object is any pass by ref value, odd stuff may happend.

About

Stateful function. Almost like reduce, but for repeated calls to a function instead of elements in a list.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published