From 52d5b44da77f381c7ecf2137f86ae7d523142733 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Sat, 18 Jan 2020 21:23:33 -0500 Subject: jarvis.js reorg --- utils/maketiles.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 utils/maketiles.js (limited to 'utils/maketiles.js') diff --git a/utils/maketiles.js b/utils/maketiles.js new file mode 100644 index 0000000..29b0c27 --- /dev/null +++ b/utils/maketiles.js @@ -0,0 +1,14 @@ +// A converter from the unusable tileUpdate format (the tiles object) to a `locs` list of tile coordinates and `tilespaces`---an object linking `locs` to small spaces which contain the tile data. + +const tilekeys = require('../utils/tilekeys'); +const Space = require('../space'); + +module.exports = (tiles) =>{ + let locs = tilekeys(tiles); + let tilespaces = {}; + for (loc of locs){ + tilespaces[loc] = new Space(); + tilespaces[loc].fromfetch(tiles, [loc, loc], conform=false); + } + return {'tilespaces':tilespaces, 'locs':locs}; +} -- cgit