From cb7d31d863320db9257a619eea0422cc43bb05a4 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Wed, 18 Dec 2019 20:56:40 -0500 Subject: added getdims and removed bug notice on README --- utils/getdims.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 utils/getdims.js (limited to 'utils') diff --git a/utils/getdims.js b/utils/getdims.js new file mode 100644 index 0000000..2c18964 --- /dev/null +++ b/utils/getdims.js @@ -0,0 +1,15 @@ +// Takes a list of coordinate pairs (like the keys from a fetch block) and returns a dimension + +function dims(coords){ + ext = [[Infinity, Infinity], [-Infinity, -Infinity]] + for (let i=0; i ext[1][0]) ext[1][0] = coord[0]; + if (coord[1] > ext[1][1]) ext[1][1] = coord[1]; + } + return ext; +} + +exports = dims -- cgit