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 - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

test.js

20

index.js

@@ -15,3 +15,3 @@ /**

}
return arr;

@@ -32,6 +32,17 @@ }

function deepConcat(matrix1, matrix2) {
return [ matrix1[0].concat(matrix2[0]) ];
}
function spiral(rows, cols, start) {
return rows ? [range(start, start + cols - 1)].concat(
transpose(spiral(cols, rows - 1, start + cols)).map(reverse)
) : [[]];
if (!rows || !cols) return [[]];
const curr = [ range(start, start + cols - 1) ];
const inner = transpose(spiral(cols, rows - 1, start + cols));
if (inner[0].length === curr[0].length) {
return curr.concat(inner.map(reverse));
} else {
return deepConcat(curr, inner);
}
}

@@ -41,2 +52,3 @@

constructor(rows, cols, start) {
start = start || 0;
this._matrix = spiral(rows, cols, start);

@@ -43,0 +55,0 @@ }

4

package.json
{
"name": "spiral-matrix",
"version": "0.1.0",
"version": "0.1.1",
"description": "Generate a spiral matrix.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node test"
},

@@ -9,0 +9,0 @@ "repository": {

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