New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gbif-map

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gbif-map - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

34

index.js
// @ts-ignore
import * as L from 'https://unpkg.com/leaflet@1.4.0/dist/leaflet-src.esm.js';
async function getGBIFIDFromQuery (q) {
const urlEncodedQuery = encodeURIComponent(q);
const response = await fetch('http://api.gbif.org/v1/species/suggest?q=' + urlEncodedQuery);
const json = await response.json();
const results = json
.filter(item => item.rank === 'SPECIES')
.filter(item => !item.synonym)
.sort((a, b) => {
if (a.status === 'ACCEPTED') {
return 1;
}
if (b.status === 'ACCEPTED') {
return -1;
}
return 0;
});
return results[0];
}
class GBIFMap extends HTMLElement {

@@ -46,3 +69,4 @@ async connectedCallback () {

const gbifId = this.getAttribute('gbif-id');
let gbifId = this.getAttribute('gbif-id');
const gbifQuery = this.getAttribute('gbif-query');
const gbifStyle = this.getAttribute('gbif-style') || 'purpleHeat.point';

@@ -58,2 +82,10 @@ const latitude = parseFloat(this.getAttribute('center-latitude'));

if (gbifQuery) {
gbifId = await getGBIFIDFromQuery(gbifQuery);
}
if (!gbifId) {
throw new Error('No GBIF id.');
}
const map = L.map(mapWrapperElement).setView([latitude, longitude], zoom);

@@ -60,0 +92,0 @@

2

package.json
{
"name": "gbif-map",
"version": "1.0.0",
"version": "1.0.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc