ES6-Geometry
Collection of immutable ES6 classes for simple 2D geometric objects and calculations.
Features
- Immutable classes.
- Statically typed using Flow.
- Arguments checking (zero overhead in production).
- Inspired by Victor.js.
Installation
npm install --save es6-geometry
Usage
As an example:
; // A vector is an offset with a certain length (magnitude) and direction.const vector = Vector; // A rectangle is defined by two points.const rectangle = 10 10 20 20; // Operations are immutable: rectangle remains untouched.const newRectangle = rectangle;
See the documentation for more information.
Development
To (re)compile, run npm run compile
. If you prefer to have a Webpack bundle, run npm run bundle
.
Tests can be invoked using npm run test
. Mocha is used as the test framework.
License
See the LICENSE.md
file (MIT).