| import * as json from './json.js'; | |
| import { plugins } from '@citation-js/core'; | |
| const scraperLinks = ['fulltext_html', 'fulltext_xml', 'fulltext_pdf']; | |
| const authorNameFields = ['name', 'lastname', 'lastName', 'firstname', 'firstName']; | |
| const ref = '@bibjson'; | |
| const parsers = { | |
| json | |
| }; | |
| const formats = { | |
| '@bibjson/quickscrape+record+object': { | |
| parse: json.quickscrapeRecord, | |
| parseType: { | |
| propertyConstraint: { | |
| props: 'link', | |
| value(links) { | |
| return scraperLinks.some(link => links.find(({ | |
| type | |
| }) => type === link)); | |
| } | |
| }, | |
| extends: '@bibjson/record+object' | |
| } | |
| }, | |
| '@bibjson/record+object': { | |
| parse: json.record, | |
| parseType: { | |
| dataType: 'SimpleObject', | |
| propertyConstraint: [{ | |
| props: 'title' | |
| }, { | |
| props: ['author', 'editor'], | |
| match: 'some', | |
| value(authors) { | |
| return Array.isArray(authors) && authors[0] && authorNameFields.some(field => field in authors[0]); | |
| } | |
| }] | |
| } | |
| }, | |
| '@bibjson/collection+object': { | |
| parse(collection) { | |
| return collection.records; | |
| }, | |
| parseType: { | |
| dataType: 'SimpleObject', | |
| propertyConstraint: [{ | |
| props: 'metadata', | |
| value(metadata) { | |
| return 'collection' in metadata; | |
| } | |
| }, { | |
| props: 'records', | |
| value(records) { | |
| return Array.isArray(records); | |
| } | |
| }] | |
| } | |
| } | |
| }; | |
| plugins.add(ref, { | |
| input: formats | |
| }); | |
| export { ref, parsers, formats }; |
Xet Storage Details
- Size:
- 1.53 kB
- Xet hash:
- a1bd3af57211ffb2e7f09d09694434b428c6cfd61992260aa129ca692cede346
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.