Skip to content

Commit 27b9a01

Browse files
committed
use umd for definition
1 parent f02e1fe commit 27b9a01

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

astar.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
// Freely distributable under the MIT License.
44
// Implements the astar search algorithm in javascript using a binary heap.
55

6+
7+
(function(definition) {
8+
if(typeof exports === 'object') {
9+
module.exports = definition();
10+
} else if(typeof define === 'function' && define.amd) {
11+
define([], definition);
12+
} else {
13+
window.astar = definition();
14+
}
15+
})(function() {
16+
617
var astar = {
718
init: function(grid) {
819
for(var x = 0, xl = grid.length; x < xl; x++) {
@@ -151,4 +162,6 @@ var astar = {
151162
}
152163
};
153164

165+
return astar;
154166

167+
});

0 commit comments

Comments
 (0)