Socket
Socket
Sign inDemoInstall

moore

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    moore

Generates Moore neighborhoods of any range/dimension


Version published
Weekly downloads
1.6K
decreased by-16.12%
Maintainers
1
Install size
5.02 kB
Created
Weekly downloads
 

Readme

Source

moore

A little module for generating Moore neighborhoods (i.e. the surrounding cells of a single cell in a grid) of arbitrary range and dimensions. Or, the blue squares for a red square:

moore

Installation

npm install moore

Usage

require('moore')(range, dimensions)

Takes two arguments, returning an array of relative coordinates.

  • range determines how large the neighborhood extends, and defaults to 1.
  • dimensions determines how many dimensions the Moore neighborhood covers - i.e. 2 will return the results for a 2D grid, and 3 will return the results for a 3D grid. May be any value above zero.
var moore = require('moore')

// 2D, 1 range:
moore(1, 2) === [
  [-1,-1], [ 0,-1], [ 1,-1],
  [-1, 0],          [ 1, 0],
  [-1, 1], [ 0, 1], [ 1, 1],
]

Keywords

FAQs

Last updated on 21 Jun 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc