Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-dois

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-dois - npm Package Compare versions

Comparing version 1.0.1-master-21da7b8a91095370bc46a1ff63fa9e56dffbb3fc to 1.0.1-master-67d90a8bef540fc30099eeaf4f8b3dbcb2c9392e

6

CHANGELOG.md

@@ -7,2 +7,8 @@ # Changelog

## [1.0.2] - 2018-11-20
### Bugfixes
- More invalid DOIs (whose registrant code is too short) are now rejected.
## [1.0.1] - 2018-11-19

@@ -9,0 +15,0 @@

2

dist/index.js

@@ -15,3 +15,3 @@ "use strict";

// A DOI is `10.`, followed by a number of digits, then a slash, and then any number of characters
return /^10\.\d+\/.*$/.test(withoutScheme) ? withoutScheme : null;
return /^10\.\d{4,}\/.*$/.test(withoutScheme) ? withoutScheme : null;
}

@@ -18,0 +18,0 @@ function isNotNull(value) {

@@ -25,2 +25,14 @@ "use strict";

});
describe('Recognising DOIs', function () {
it('should not return identifiers whose registrant code is too short', function () {
var dom = new jsdom_1.JSDOM("<!DOCTYPE html><html><head>\n <meta name=\"dc.identifier\" content=\"10.312/osf.io/khbvy\">\n </head><p>No DOIs here!</p></html>");
var document = dom.window.document;
expect(index_1.getDois(document)).toEqual([]);
});
it('should find valid identifiers', function () {
var dom = new jsdom_1.JSDOM("<!DOCTYPE html><html><head>\n <meta name=\"dc.identifier\" content=\"10.31219/osf.io/khbvy\">\n </head><p>Hello there</p></html>");
var document = dom.window.document;
expect(index_1.getDois(document)).toEqual(['10.31219/osf.io/khbvy']);
});
});
describe('Detecting DOIs located in dc.identifier meta tags', function () {

@@ -27,0 +39,0 @@ it('should not return identifiers that are not DOIs', function () {

@@ -46,2 +46,26 @@ import { JSDOM } from 'jsdom';

describe('Recognising DOIs', () => {
it('should not return identifiers whose registrant code is too short', () => {
const dom = new JSDOM(
`<!DOCTYPE html><html><head>
<meta name="dc.identifier" content="10.312/osf.io/khbvy">
</head><p>No DOIs here!</p></html>`
);
const document = dom.window.document;
expect(getDois(document)).toEqual([]);
});
it('should find valid identifiers', () => {
const dom = new JSDOM(
`<!DOCTYPE html><html><head>
<meta name="dc.identifier" content="10.31219/osf.io/khbvy">
</head><p>Hello there</p></html>`
);
const document = dom.window.document;
expect(getDois(document)).toEqual(['10.31219/osf.io/khbvy']);
});
});
describe('Detecting DOIs located in dc.identifier meta tags', () => {

@@ -48,0 +72,0 @@ it('should not return identifiers that are not DOIs', () => {

@@ -16,3 +16,3 @@ import './polyfills';

// A DOI is `10.`, followed by a number of digits, then a slash, and then any number of characters
return /^10\.\d+\/.*$/.test(withoutScheme) ? withoutScheme : null;
return /^10\.\d{4,}\/.*$/.test(withoutScheme) ? withoutScheme : null;
}

@@ -19,0 +19,0 @@

{
"name": "get-dois",
"version": "1.0.1-master-21da7b8a91095370bc46a1ff63fa9e56dffbb3fc",
"version": "1.0.1-master-67d90a8bef540fc30099eeaf4f8b3dbcb2c9392e",
"description": "Detect Digital Object Identifiers listed in the metadata of a DOM tree",

@@ -5,0 +5,0 @@ "scripts": {

@@ -5,3 +5,3 @@ get-dois

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.
Unfortunately, academic publishers use a wide variety of metadata "standards". This package normalises between Dublin Core, Highwire Press tags, [etc.](#supported-meta-tags), and the different formatting rules used for DOIs.

@@ -38,4 +38,15 @@ To use this library outside of a browser context, you can use a library like [jsdom](https://www.npmjs.com/package/jsdom).

## Supported meta tags
At the time of writing, `get-dois` supports detecting DOIs embedded in a webpage as:
- Highwire Press tags (`citation_doi`)
- Eprints tags (`eprints.id_number` and/or `eprints.official_url`)
- bepress tags (`bepress_citation_doi`)
- Dublin Core Schema markup (`dc.identifier` and/or `dc.relation`)
If you encounter a different format that is not yet supported, please [file an issue](https://gitlab.com/Flockademic/get-dois/issues/new).
## License
MIT © [Vincent Tunru](https://vincenttunru.com)
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