New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

floop

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

floop

Functional for-loop implementation in JS

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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(condition ,body ,final_expression ,initialization ,context)

Examples:

;(function () {
  var i
  function initialization () {
    i = 0
  }

  function condition () {
    return i < 2
  }

  function final_expression () {
    i++
  }

  function body () {
    console.log(i)
  }
  
  floop(condition ,body ,final_expression ,initialization)
})()
var context = {}
function initialization (context) {
  context.i = 0
  context.sum = 0
}

function condition (context) {
  return context.i < 2
}

function final_expression (context) {
  context.i++
}

function body (context) {
  context.sum += i
  return context.sum
}

  floop(condition ,body ,final_expression ,initialization ,context)
;(function () {
  var i = 0
  floop( function () { return i < 5 }
       , function () { console.log(i) }
       , function () { i++ }
       )
})()
//nice minimal syntax
;(function () {
  var i = 0
  floop(function () { return i < 5 } ,function () {
    console.log(i)
    i++
  })
})()
//loops forever
floop()

License

AGPL

Final note

Seriously, never use this.

Keywords

FAQs

Package last updated on 26 Jun 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc