| import { util } from '@citation-js/core'; | |
| import parseDoiJson from './json.js'; | |
| const apiOptions = { | |
| checkContentType: true, | |
| headers: { | |
| Accept: 'application/vnd.citationstyles.csl+json' | |
| } | |
| }; | |
| function processApiResponse(response) { | |
| if (response === '[]') { | |
| return {}; | |
| } | |
| return parseDoiJson(JSON.parse(response)); | |
| } | |
| function parseDoiApiAsync(data) { | |
| const response = [].concat(data).map(url => util.fetchFileAsync(url, apiOptions).then(processApiResponse)); | |
| return Promise.all(response); | |
| } | |
| function parseDoiApi(data) { | |
| const response = [].concat(data).map(url => util.fetchFile(url, apiOptions)).map(processApiResponse); | |
| return response; | |
| } | |
| export { parseDoiApi as parse, parseDoiApiAsync as parseAsync }; |
Xet Storage Details
- Size:
- 730 Bytes
- Xet hash:
- afc8bd664d80ae77d03d25c026318c24d6307919a973c70bd366292330633d78
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.