Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

vector2d-lib

0.0.12 • Public • Published

vector2d-lib

A 2d JavaScript Vector library.

Install

To include vector2d-lib as a component in your project, use the node module.

npm install vector2d-lib --save

You can also use the standalone version and reference the js file from your document.

<html>
  <head>
    <script src="scripts/vector2d-lib.js" type="text/javascript" charset="utf-8"></script>
  </head>
  ...

Usage

The module exports a Vector class. In a nodejs project, you access it via:

var Vector = require('vector2d-lib');
var vecA = new Vector(10, 10);

In the browser, the Vector class is a global.

To learn how to use the various Vector functions, please review the docs.

<html>
  <head>
    <script src="scripts/vector2d-lib.js" type="text/javascript" charset="utf-8"></script>
  </head>
  <body>
    <script>
      var vecA = new Vector(10, 10);
    </script>
  </body>
</html>

Building this project

This project uses Grunt. To build the project first install the node modules.

npm install

Next, run grunt.

grunt

To run the tests, run 'npm test'.

npm test

To check test coverage run 'grunt coverage'.

grunt coverage

A pre-commit hook is defined in /pre-commit that runs jshint. To use the hook, run the following:

ln -s ../../pre-commit .git/hooks/pre-commit

A post-commit hook is defined in /post-commit that runs the Plato complexity analysis tools. To use the hook, run the following:

ln -s ../../post-commit .git/hooks/post-commit

Keywords

install

npm i vector2d-lib

Downloadsweekly downloads

21

version

0.0.12

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability