directions
v2.1.1
Published
Add in locations by name and lengths/durations to those locations after which you can ask for directions
Downloads
8
Maintainers
Readme
directions
Add in locations by name and lengths/durations to those locations after which you can ask for directions.
Usage
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.