From 80b6e68c1016e5c6a660de2d84c2fa8a9899af93 Mon Sep 17 00:00:00 2001 From: Guillermo Peralta Scura Date: Mon, 22 Jul 2019 20:02:13 -0400 Subject: [PATCH] Use type coercion comparison for matching keys --- examples/node-example/package-lock.json | 27 +++++++++++++++++++++++++ package-lock.json | 2 +- src/components/ChoroplethLayer.vue | 4 ++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/examples/node-example/package-lock.json b/examples/node-example/package-lock.json index 28594f6..85b0a7d 100644 --- a/examples/node-example/package-lock.json +++ b/examples/node-example/package-lock.json @@ -1374,6 +1374,11 @@ "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", "dev": true }, + "chroma-js": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-1.4.1.tgz", + "integrity": "sha512-jTwQiT859RTFN/vIf7s+Vl/Z2LcMrvMv3WUFmd/4u76AdlFC0NTNgqEEFPcRiHmAswPsMiQEDZLM8vX8qXpZNQ==" + }, "cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", @@ -8311,6 +8316,23 @@ "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz", "integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ==" }, + "vue-choropleth": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/vue-choropleth/-/vue-choropleth-0.3.0.tgz", + "integrity": "sha512-2fDTUpEUbFhIiV/lQZ6dtwjYUuQQVCsHBpivUHepyyTkOhfjgjB5SNIdRwRZPCKnH4uc5Ke1WiZm8DEdV12gVw==", + "requires": { + "chroma-js": "^1.3.4", + "leaflet": "^1.3.4", + "vue2-leaflet": "2.1.1" + }, + "dependencies": { + "leaflet": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.5.1.tgz", + "integrity": "sha512-ekM9KAeG99tYisNBg0IzEywAlp0hYI5XRipsqRXyRTeuU8jcuntilpp+eFf5gaE0xubc9RuSNIVtByEKwqFV0w==" + } + } + }, "vue-hot-reload-api": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.2.4.tgz", @@ -8426,6 +8448,11 @@ "integrity": "sha512-x3LV3wdmmERhVCYy3quqA57NJW7F3i6faas++pJQWtknWT+n7k30F4TVdHvCLn48peTJFRvCpxs3UuFPqgeELg==", "dev": true }, + "vue2-leaflet": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/vue2-leaflet/-/vue2-leaflet-2.1.1.tgz", + "integrity": "sha512-boJIObTHJOtiLqPDtcL8FdQMr/PLDyZ6/InQBU13mcmNtn4/hvzbyqLmVtvWbRFeGOifAMkJBlbj3gLjrhFdmw==" + }, "watchpack": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.4.0.tgz", diff --git a/package-lock.json b/package-lock.json index 6122179..9cfcd69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vue-choropleth", - "version": "0.2.1", + "version": "0.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/components/ChoroplethLayer.vue b/src/components/ChoroplethLayer.vue index 27c77e7..0bb8427 100644 --- a/src/components/ChoroplethLayer.vue +++ b/src/components/ChoroplethLayer.vue @@ -22,7 +22,7 @@ function mouseover({ target }) { let geojsonItem = target.feature.properties let item = this.geojsonData.data.find( - x => x[this.idKey] === geojsonItem[this.geojsonIdKey] + x => x[this.idKey] == geojsonItem[this.geojsonIdKey] ) if (!item) { this.currentItem = { name: "", value: 0 } @@ -84,7 +84,7 @@ export default { let itemGeoJSONID = feature.properties[this.geojsonIdKey] let color = "NONE" const {data} = this.geojsonData - let item = data.find(x => x[this.idKey] === itemGeoJSONID) + let item = data.find(x => x[this.idKey] == itemGeoJSONID) if (!item) { return { color: "white",