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 3.0.0-6-dc-relation-should-not-be-fetched-from-274459359-39d33d99 to 3.0.0-7-add-support-for-figshare-s-format-372922930-ae2fbb22

4

CHANGELOG.md

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

### New features
- DC.identifier.DOI tags are now supported. In concrete terms, this should mean that more items on Figshare should now be recognised.
## [3.0.0] - 2019-08-17

@@ -9,0 +13,0 @@

@@ -11,2 +11,3 @@ "use strict";

'prism.doi',
'dc.identifier.doi',
];

@@ -13,0 +14,0 @@ function parseDoi(identifier) {

@@ -209,2 +209,31 @@ "use strict";

});
// DC.identifier.DOI is used by some Figshare pages. See
// https://gitlab.com/Flockademic/get-dois/issues/7
describe('Detecting DOIs located in DC.identfier.DOI meta tags', function () {
it('should not return identifiers that are not DOIs', function () {
var dom = new jsdom_1.JSDOM("<!DOCTYPE html><html><head>\n <meta name=\"DC.identifier.DOI\" content=\"https://osf.io/khbvy/\">\n </head><p>No DOIs here!</p></html>");
var document = dom.window.document;
expect(index_1.getDois(document)).toEqual([]);
});
it('should return a naked DOI', function () {
var dom = new jsdom_1.JSDOM("<!DOCTYPE html><html><head>\n <meta name=\"DC.identifier.DOI\" 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']);
});
it('should return a DOI prefixed with `doi:`', function () {
var dom = new jsdom_1.JSDOM("<!DOCTYPE html><html><head>\n <meta name=\"DC.identifier.DOI\" content=\"doi: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']);
});
it('should return a DOI prefixed with `info:doi:`', function () {
var dom = new jsdom_1.JSDOM("<!DOCTYPE html><html><head>\n <meta name=\"DC.identifier.DOI\" content=\"info:doi: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']);
});
it('should return multiple DOIs when present', function () {
var dom = new jsdom_1.JSDOM("<!DOCTYPE html><html><head>\n <meta name=\"DC.identifier.DOI\" content=\"info:doi:10.31219/osf.io/khbvy\">\n <meta name=\"DC.identifier.DOI\" content=\"10.1371/journal.pbio.1002456\">\n </head><p>Hello there</p></html>");
var document = dom.window.document;
expect(index_1.getDois(document)).toEqual(['10.31219/osf.io/khbvy', '10.1371/journal.pbio.1002456']);
});
});
describe('Detecting DOIs located in meta tags identified by the `property` attribute', function () {

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

@@ -439,2 +439,62 @@ import { JSDOM } from 'jsdom';

// DC.identifier.DOI is used by some Figshare pages. See
// https://gitlab.com/Flockademic/get-dois/issues/7
describe('Detecting DOIs located in DC.identfier.DOI meta tags', () => {
it('should not return identifiers that are not DOIs', () => {
const dom = new JSDOM(
`<!DOCTYPE html><html><head>
<meta name="DC.identifier.DOI" content="https://osf.io/khbvy/">
</head><p>No DOIs here!</p></html>`
);
const document = dom.window.document;
expect(getDois(document)).toEqual([]);
});
it('should return a naked DOI', () => {
const dom = new JSDOM(
`<!DOCTYPE html><html><head>
<meta name="DC.identifier.DOI" 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']);
});
it('should return a DOI prefixed with `doi:`', () => {
const dom = new JSDOM(
`<!DOCTYPE html><html><head>
<meta name="DC.identifier.DOI" content="doi: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']);
});
it('should return a DOI prefixed with `info:doi:`', () => {
const dom = new JSDOM(
`<!DOCTYPE html><html><head>
<meta name="DC.identifier.DOI" content="info:doi: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']);
});
it('should return multiple DOIs when present', () => {
const dom = new JSDOM(
`<!DOCTYPE html><html><head>
<meta name="DC.identifier.DOI" content="info:doi:10.31219/osf.io/khbvy">
<meta name="DC.identifier.DOI" content="10.1371/journal.pbio.1002456">
</head><p>Hello there</p></html>`
);
const document = dom.window.document;
expect(getDois(document)).toEqual(['10.31219/osf.io/khbvy', '10.1371/journal.pbio.1002456']);
});
});
describe('Detecting DOIs located in meta tags identified by the `property` attribute', () => {

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

@@ -10,2 +10,3 @@ import './polyfills';

'prism.doi',
'dc.identifier.doi',
];

@@ -12,0 +13,0 @@

2

package.json
{
"name": "get-dois",
"version": "3.0.0-6-dc-relation-should-not-be-fetched-from-274459359-39d33d99",
"version": "3.0.0-7-add-support-for-figshare-s-format-372922930-ae2fbb22",
"description": "Detect Digital Object Identifiers listed in the metadata of a DOM tree",

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

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