diff --git a/package.json b/package.json index 24d370c..18090ee 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "author": "Vladimir Agafonkin", "license": "ISC", "dependencies": { - "kdbush": "^4.0.1" + "kdbush": "^4.0.2" }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.0.2", diff --git a/test/test.js b/test/test.js index 74671ff..5fb0510 100644 --- a/test/test.js +++ b/test/test.js @@ -172,3 +172,10 @@ test('makes sure unclustered point coords are not rounded', () => { assert.deepEqual(index.getTile(20, 1028744, 656754).features[0].geometry[0], [421, 281]); }); + +test('does not throw on zero items', () => { + assert.doesNotThrow(() => { + const index = new Supercluster().load([]); + assert.deepEqual(index.getClusters([-180, -85, 180, 85], 0), []); + }); +}); diff --git a/yarn.lock b/yarn.lock index 5b3699a..0337c0e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -698,10 +698,10 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -kdbush@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/kdbush/-/kdbush-4.0.1.tgz#c411c5571d246c7f012ea5980ea720023d663329" - integrity sha512-RlSWHFOf40nU5Be8dZIzdA8j6Jn9IYskSPSZwkDCooGb16uXeUx/6QZuW+krdEToViiK2OAwfW7QWDHY+kAz0A== +kdbush@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/kdbush/-/kdbush-4.0.2.tgz#2f7b7246328b4657dd122b6c7f025fbc2c868e39" + integrity sha512-WbCVYJ27Sz8zi9Q7Q0xHC+05iwkm3Znipc2XTlrnJbsHMYktW4hPhXUE8Ys1engBrvffoSCqbil1JQAa7clRpA== levn@^0.4.1: version "0.4.1"