get-dois
A small module that takes a DOM tree and returns all Digital Object Identifiers (DOIs) located in that tree's metadata.
Unfortunately, academic publishers use a wide variety of metadata "standards". This package normalises between Dublin Core, Highwire Press tags, etc., and the different formatting rules used for DOIs.
To use this library outside of a browser context, you can use a library like jsdom.
This project also includes TypeScript type definitions.
Installation
npm install get-dois --save
Usage
import { getDois } from 'get-dois';
const head = document.getElementsByTagName('head').item(0);
const dois = getDois(head);
API
getDois(domTree: Document | Element): string[]
Parameter: domTree
Either window.document
or an HTML element whose children might include meta tags containing a DOI.
Returns
An array of DOIs. If no DOIs are found, this will return an empty array. Duplicate DOIs will only be listed once. Note that a page might list multiple DOIs.
License
MIT © Vincent Tunru