floop
v0.2.2
Published
Functional for-loop implementation in JS
Downloads
2
Readme
floop
Functional for-loop implementation in JS
Allows you to write for loops without those pesky semicolons
Installation
npm install floop
Usage
var floop = require('floop')
floop(initialization ,condition ,final_expression ,body ,context)
Examples:
;(function () {
var i
function initialization () {
i = 0
}
function condition () {
return i < 2
}
function final_expression () {
i++
}
function body () {
console.log(i)
}
floop(initialization ,condition ,final_expression ,body)
})()
var context = {}
function initialization (context) {
context.i = 0
}
function condition (context) {
context.i < 2
}
function final_expression (context) {
context.i++
}
function body (context) {
context.sum += i
return context.sum
}
floop(initialization ,condition ,final_expression ,body ,context)
License
MIT License