npm install astar-template
const PathFinder = require('astar-template')
let finder = new PathFinder();
finder.debug = function (node) {}
......
let apath = finder.astar(fromNode, toNode);
if(apath.length=0) { //cannot arrive } else { //apath is array of nodes }
class ABCNode {
constructor(a=null, b=null, c=null, src=null) {
this.parent = src;
this.a = a;
this.b = b;
this.c = c;
this.g = 0;
this.h = 0;
}
}
class XYNode {
constructor(x=null, y=null, src=null) {
this.parent = src;
this.x = x;
this.y = y;
this.g = 0;
this.h = 0;
}
}