@citation-js/plugin-bibjson
Advanced tools
Comparing version 0.4.7 to 0.4.8
import * as json from './json'; | ||
import { plugins } from '@citation-js/core'; | ||
var scraperLinks = ['fulltext_html', 'fulltext_xml', 'fulltext_pdf']; | ||
var ref = '@bibjson'; | ||
var parsers = { | ||
json: json | ||
let scraperLinks = ['fulltext_html', 'fulltext_xml', 'fulltext_pdf']; | ||
const ref = '@bibjson'; | ||
const parsers = { | ||
json | ||
}; | ||
var formats = { | ||
const formats = { | ||
'@bibjson/quickscrape+record+object': { | ||
@@ -14,12 +14,11 @@ parse: json.quickscrapeRecord, | ||
props: 'link', | ||
value: function value(links) { | ||
return scraperLinks.some(function (link) { | ||
return links.find(function (_ref) { | ||
var type = _ref.type; | ||
return type === link; | ||
}); | ||
}); | ||
value(links) { | ||
return scraperLinks.some(link => links.find(({ | ||
type | ||
}) => type === link)); | ||
} | ||
}, | ||
"extends": '@bibjson/record+object' | ||
extends: '@bibjson/record+object' | ||
} | ||
@@ -36,5 +35,7 @@ }, | ||
match: 'some', | ||
value: function value(authors) { | ||
value(authors) { | ||
return Array.isArray(authors) && authors[0] && 'name' in authors[0]; | ||
} | ||
}] | ||
@@ -44,5 +45,6 @@ } | ||
'@bibjson/collection+object': { | ||
parse: function parse(collection) { | ||
parse(collection) { | ||
return collection.records; | ||
}, | ||
parseType: { | ||
@@ -52,10 +54,14 @@ dataType: 'SimpleObject', | ||
props: 'metadata', | ||
value: function value(metadata) { | ||
value(metadata) { | ||
return 'collection' in metadata; | ||
} | ||
}, { | ||
props: 'records', | ||
value: function value(records) { | ||
value(records) { | ||
return Array.isArray(records); | ||
} | ||
}] | ||
@@ -62,0 +68,0 @@ } |
@@ -1,3 +0,1 @@ | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
import { parse as parseDate } from '@citation-js/date'; | ||
@@ -7,3 +5,3 @@ import { parse as parseName } from '@citation-js/name'; | ||
function nameProps(person) { | ||
var firstname = person.firstname, | ||
let firstname = person.firstname, | ||
lastname = person.lastname, | ||
@@ -17,4 +15,4 @@ _person$firstName = person.firstName, | ||
return { | ||
given: given, | ||
family: family | ||
given, | ||
family | ||
}; | ||
@@ -26,10 +24,10 @@ } else if (person.name) { | ||
var identifiers = ['PMID', 'PMCID', 'DOI', 'ISBN']; | ||
var journalIdentifiers = ['ISSN']; | ||
let identifiers = ['PMID', 'PMCID', 'DOI', 'ISBN']; | ||
let journalIdentifiers = ['ISSN']; | ||
function idProps(input, identifiers) { | ||
var output = {}; | ||
let output = {}; | ||
for (var prop in input) { | ||
var upperCaseProp = prop.toUpperCase(); | ||
for (let prop in input) { | ||
let upperCaseProp = prop.toUpperCase(); | ||
@@ -48,3 +46,3 @@ if (identifiers.includes(upperCaseProp)) { | ||
for (var _iterator = input.identifier[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var _step$value = _step.value, | ||
let _step$value = _step.value, | ||
id = _step$value.id, | ||
@@ -64,4 +62,4 @@ _step$value$type = _step$value.type, | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator["return"] != null) { | ||
_iterator["return"](); | ||
if (!_iteratorNormalCompletion && _iterator.return != null) { | ||
_iterator.return(); | ||
} | ||
@@ -79,3 +77,3 @@ } finally { | ||
var typeMap = { | ||
let typeMap = { | ||
article: 'article', | ||
@@ -106,3 +104,3 @@ book: 'book', | ||
function generalProps(input) { | ||
var output = { | ||
let output = { | ||
type: typeMap[input.type] || 'book' | ||
@@ -142,3 +140,3 @@ }; | ||
if (input.date && Object.keys(input.date).length > 0) { | ||
var dates = input.date; | ||
let dates = input.date; | ||
@@ -159,3 +157,3 @@ if (dates.submitted) { | ||
if (input.journal) { | ||
var journal = input.journal; | ||
let journal = input.journal; | ||
@@ -187,3 +185,3 @@ if (journal.name) { | ||
if (input.link && _typeof(input.link[0]) === 'object') { | ||
if (input.link && typeof input.link[0] === 'object') { | ||
output.URL = input.link[0].url; | ||
@@ -203,7 +201,7 @@ } | ||
var parseContentMine = function parseContentMine(data) { | ||
const parseContentMine = function parseContentMine(data) { | ||
return Object.assign(generalProps(data), quickscrapeSpecificProps(data)); | ||
}; | ||
var parseBibJson = function parseBibJson(data) { | ||
const parseBibJson = function parseBibJson(data) { | ||
return generalProps(data); | ||
@@ -210,0 +208,0 @@ }; |
{ | ||
"name": "@citation-js/plugin-bibjson", | ||
"version": "0.4.7", | ||
"version": "0.4.8", | ||
"description": "Plugin for BibJSON formats for Citation.js", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@citation-js/core": "^0.4.7" | ||
"@citation-js/core": "^0.4.8" | ||
}, | ||
@@ -43,3 +43,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "96d42cc13bf1ce0a53f54f186007ff40b15d1460" | ||
"gitHead": "0be8501cbe0541828e73912230b9d56762038f8d" | ||
} |
16313
457