0.1.34 • Published 4 years ago

@mitchallen/connection-grid v0.1.34

Weekly downloads
34
License
ISC
Repository
github
Last release
4 years ago

@mitchallen/connection-grid

Map connections between cells in a 2D grid.


Installation

You must use npm 2.7.0 or higher because of the scoped package name.

$ npm init
$ npm install @mitchallen/connection-grid --save

Usage

"use strict";
    
let gridFactory = require("@mitchallen/connection-grid");
    
let xSize = 5;
let ySize = 6;

let grid = gridFactory.Square({ x: xSize, y: ySize });

Browser Usage:

You can reference a minimized client version inside an HTML script tag using one of these URL's:

Example:

    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <title>Connection-Grid Example</title>
        <meta name="description" content="Connection Grid Example">
        <script src="https://unpkg.com/@mitchallen/connection-grid@0.1.33/dist/connection-grid.min.js"></script>
        <script>
          var factory = window.MitchAllen.ConnectionGrid;
          console.log(factory);
          var xSize = 10, ySize = 5;
          var sg = factory.Square( { x: xSize, y: ySize } );
          sg.log(); 
        </script>
      </head>
      <body>
        <h1>Connection Grid Example</h1>
      </body>
    </html>

Testing

To test, go to the root folder and type (sans $):

$ npm test

Run all tests using nodemon:

$ npm run test-nodemon

Run suites using nodemon:

$ npm run test-square
$ npm run test-hexagon
$ npm run test-triangle
$ npm run test-circle

Repo(s)


Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.


Version History

Version 0.1.28

  • replaced modules/square.js with @mitchallen/connection-grid-square

Version 0.1.27

  • square now uses @mitchallen/grid-square

Version 0.1.26

  • Replaced modules/base.js with @mitchallen/connection-grid-core

Version 0.1.25

  • Browser now must use window.MitchAllen.ConnectionGrid.

Version 0.1.24

  • Updated CDN URL

Version 0.1.23

  • Added client example

Version 0.1.22

  • Changed client window name to 'ConnectionGrid'

Version 0.1.21

  • Added client distribution

Version 0.1.20

  • updated to latest grid

Version 0.1.19

  • Updated documentation for connection directions
  • Removed unused code

Version 0.1.18

  • Refactored Circle.getNeighbor
  • Fixed bug in Circle.getNeighbor

Version 0.1.17

  • Add connectsAny method

Version 0.1.16

  • Cirlce.getNeighbor with CW for last cell in ring now wraps properly

Version 0.1.15

  • Added Triangle method

Version 0.1.14

  • Fixed bug in isDir
  • Fixed Circle direction mapp

Version 0.1.13

  • Refactored code base and tests

Version 0.1.12

  • Added tests for Circle

Version 0.1.11

  • Added Hexagon and Circle methods

Version 0.1.10

  • now uses @mitchallen/grid 0.1.10

Version 0.1.9

  • now uses @mitchallen/grid 0.1.9
  • changed internal use of grid.create to grid.Square
  • added Square method to replace create method
  • added test suites for Square method
  • create method now generates deprecation warning

Version 0.1.8

  • now uses @mitchallen/grid 0.1.8
  • added experimental Hexagon method

Version 0.1.7

  • now uses @mitchallen/grid 0.1.7
  • x and y values that are missing or less than 0 will be normalized to 0
  • updated tests

Version 0.1.6

  • added replaced getDirMap function with dirMap property

Version 0.1.5

  • added getOppositeDir method

Version 0.1.5

  • added getOppositeDir method

Version 0.1.4

  • added mask and isMasked methods

Version 0.1.3

  • now uses @mitchallen/grid 0.1.6

Version 0.1.2

  • added connects method

Version 0.1.1

  • fixed bug in hasConnections

Version 0.1.0

  • initial release

0.1.34

4 years ago

0.1.33

5 years ago

0.1.32

5 years ago

0.1.31

5 years ago

0.1.30

5 years ago

0.1.29

5 years ago

0.1.28

9 years ago

0.1.27

9 years ago

0.1.26

9 years ago

0.1.25

9 years ago

0.1.24

9 years ago

0.1.23

9 years ago

0.1.22

9 years ago

0.1.21

9 years ago

0.1.20

9 years ago

0.1.19

10 years ago

0.1.18

10 years ago

0.1.17

10 years ago

0.1.16

10 years ago

0.1.15

10 years ago

0.1.14

10 years ago

0.1.13

10 years ago

0.1.12

10 years ago

0.1.11

10 years ago

0.1.10

10 years ago

0.1.9

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago