Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spiralloop

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spiralloop

Create for loops that spiral from the center or a given point

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

SpiralLoop

Ever wanted to do a for loop starting from the center instead of a corner? Now you can!

Install

npm install spiralloop

Usage

spiral(Lengths, [Center], Function)

Lengths

An array of the lengths of your loop, such as [4, 4] or [5, 3, 7]. Handles array lengths as long as you'd like.

Center (Optional)

The default center is in the middle (1.5, 1.5 of a 3x3) but feel free to change this up.

Function

A function that will give paramaters of the current value. For example:

function(x, y, z) { }

If you return true in this function, it will act as a "break".

Example

var spiral = require('spiralloop');

spiral([3, 3], function(x, y) {
	console.log(x + ', ' + y);
});

Keywords

FAQs

Package last updated on 08 Oct 2015

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