New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@citation-js/core

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@citation-js/core - npm Package Compare versions

Comparing version 0.7.11 to 0.7.13

18

lib-mjs/util/fetchFile.js

@@ -5,11 +5,17 @@ import syncFetch from 'sync-fetch';

import pkg from '../../package.json';
const isBrowser = typeof location !== 'undefined' && typeof navigator !== 'undefined';
const {
fetch: asyncFetch,
Headers: asyncHeaders
} = typeof fetch === 'function' && isBrowser ? {
fetch,
Headers
} = fetchPolyfill();
const corsEnabled = typeof location !== 'undefined' && typeof document !== 'undefined';
let userAgent = corsEnabled ? '' : `Citation.js/${pkg.version} Node.js/${process.version}`;
} : fetchPolyfill();
let userAgent = `Citation.js/${pkg.version}`;
if (process && process.release && process.release.name === 'node' && process.version) {
userAgent += ` Node.js/${process.version}`;
}
function normaliseHeaders(headers) {
const result = {};
const entries = headers instanceof Headers || headers instanceof syncFetch.Headers ? Array.from(headers) : Object.entries(headers);
const entries = headers instanceof asyncHeaders || headers instanceof syncFetch.Headers ? Array.from(headers) : Object.entries(headers);
for (const [name, header] of entries) {

@@ -28,3 +34,3 @@ result[name.toLowerCase()] = header.toString();

};
if (userAgent && !corsEnabled) {
if (userAgent && !isBrowser) {
reqOpts.headers['user-agent'] = userAgent;

@@ -78,3 +84,3 @@ }

logger.http('[core]', reqOpts.method, url, reqOpts);
return fetch(url, reqOpts).then(response => checkResponse(response, reqOpts)).then(response => response.text());
return asyncFetch(url, reqOpts).then(response => checkResponse(response, reqOpts)).then(response => response.text());
}

@@ -81,0 +87,0 @@ export function setUserAgent(newUserAgent) {

@@ -15,11 +15,17 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const isBrowser = typeof location !== 'undefined' && typeof navigator !== 'undefined';
const {
fetch: asyncFetch,
Headers: asyncHeaders
} = typeof fetch === 'function' && isBrowser ? {
fetch,
Headers
} = (0, _fetchPonyfill.default)();
const corsEnabled = typeof location !== 'undefined' && typeof document !== 'undefined';
let userAgent = corsEnabled ? '' : `Citation.js/${_package.default.version} Node.js/${process.version}`;
} : (0, _fetchPonyfill.default)();
let userAgent = `Citation.js/${_package.default.version}`;
if (process && process.release && process.release.name === 'node' && process.version) {
userAgent += ` Node.js/${process.version}`;
}
function normaliseHeaders(headers) {
const result = {};
const entries = headers instanceof Headers || headers instanceof _syncFetch.default.Headers ? Array.from(headers) : Object.entries(headers);
const entries = headers instanceof asyncHeaders || headers instanceof _syncFetch.default.Headers ? Array.from(headers) : Object.entries(headers);
for (const [name, header] of entries) {

@@ -38,3 +44,3 @@ result[name.toLowerCase()] = header.toString();

};
if (userAgent && !corsEnabled) {
if (userAgent && !isBrowser) {
reqOpts.headers['user-agent'] = userAgent;

@@ -88,3 +94,3 @@ }

_logger.default.http('[core]', reqOpts.method, url, reqOpts);
return fetch(url, reqOpts).then(response => checkResponse(response, reqOpts)).then(response => response.text());
return asyncFetch(url, reqOpts).then(response => checkResponse(response, reqOpts)).then(response => response.text());
}

@@ -91,0 +97,0 @@ function setUserAgent(newUserAgent) {

{
"name": "@citation-js/core",
"version": "0.7.11",
"version": "0.7.13",
"description": "Convert different bibliographic metadata sources",

@@ -43,3 +43,3 @@ "keywords": [

},
"gitHead": "a92f6b3c20b9342feb0303a017b806b312d66486"
"gitHead": "9259e28a219854228c394f278c4973ee911d2bef"
}
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