directions

2.1.1 • Public • Published

directions

experimental

Add in locations by name and lengths/durations to those locations after which you can ask for directions.

Usage

NPM

Example

var directions = require( 'directions' );
 
var someDirections = directions();
 
someDirections.fromTo( 'alpha', 'idle', 1.2 );
someDirections.fromTo( 'idle', 'rolled', 1 );
someDirections.fromTo( 'rolled', 'idle', 3 );
someDirections.fromTo( 'idle', 'omega', 1.5 );
 
var data = someDirections.getPath( 'alpha', 'omega' );
 
console.log( data.cost ); // 2.7
console.log( data.path ); // [ 'alpha', 'idle', 'omega' ]
console.log( someDirections.getPath( 'alpha', 'rolled', 'omega' ) ); // [ 'alpha', 'idle', 'rolled', 'idle', 'omega' ]
console.log( someDirections.fromTo( 'alpha', 'idle' ) ); // 1.2

License

MIT, see LICENSE.md for details.

Package Sidebar

Install

npm i directions

Weekly Downloads

27

Version

2.1.1

License

MIT

Last publish

Collaborators

  • mikkoh