Find out who eats who in the world: what do rats (Rattus rattus) eat?, or what do hardhead catfish (Ariopsis felis) eat?. Data provided via Global Biotic Interactions (GloBI, https://globalbioticinteractions.org) .
npm install globi-data
A javascript libray to help find out what species interact (e.g. eats, is eaten by) with. Data provided via Global Biotic Interactions (GloBI, https://globalbioticinteractions.org).
``javascript
var consoleDiv = document.getElementById('console');
// lookup some species by some string 'sea otter'
var closeMatchCallback = function(closeMatches) {
closeMatches.forEach(function(closeMatch){
// log scientific names of matches
console.log(closeMatch.scientificName);
var p = document.createElement('p');
p.innerHTML = 'close match for sea otter [' + closeMatch.scientificName + ']';
consoleDiv.appendChild(p);
});
};
globiData.findCloseTaxonMatches('sea otter', closeMatchCallback);
// find out what a sea otter (Enhydra lutris) eats. . .
var search = {sourceTaxonScientificName: 'Enhydra lutris', interactionType: 'preysOn'};
var callback = function(interactions) {
interactions.forEach(function(interaction) {
var p = document.createElement('p');
p.innerHTML = '[' + interaction.source.name + '] preys on [' + interaction.target.name + ']';
consoleDiv.appendChild(p);
});
};
globiData.findSpeciesInteractions(search, callback);
// lookup some more info (including image urls) about the sea otter
var infoCallback = function(taxonInfo) {
var name = taxonInfo.commonName + ' (' + taxonInfo.scientificName + ')';
var infoDiv = document.createElement('div');
infoDiv.innerHTML = '

usage
Make sure to include eol-globi-data-js in your project / page.
Node Package Manager (NPM)
`javascript
var globiData = require('globi-data');
`for example node project that uses globi-data see: http://github.com/jhpoelen/eol-globi-js .
Directly into html
include globi-data-dist.js in your web resources and include using script tag.
`html
...