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

spiral-matrix

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

spiral-matrix

Generate a spiral matrix.

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

spiral-matrix

Build Status npm Downloads Dependencies LICENSE

Generate a spiral matrix.

Installation

You can easily install this module via npm.

$ npm install spiral-matrix

Usage

First, import the SpiralMatrix module.

const SpiralMatrix = require('spiral-matrix');

Then, You can generate a spiral matrix with following code:

const spiralMatrix = new SpiralMatrix(6, 6, 0);
// This will generate a 6 by 6 spiral matrix which start from 0.
// Like this:
// [ [ 0, 1, 2, 3, 4, 5 ],
//   [ 19, 20, 21, 22, 23, 6 ],
//   [ 18, 31, 32, 33, 24, 7 ],
//   [ 17, 30, 35, 34, 25, 8 ],
//   [ 16, 29, 28, 27, 26, 9 ],
//   [ 15, 14, 13, 12, 11, 10 ] ]

SpiralMatrix object has two methods.

spiralMatrix.get(); // Returns matrix as two dimensional array.
spiralMatrix.toString(); // Returns matrix as string.

License

GFDL-1.2

Keywords

FAQs

Package last updated on 09 May 2016

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