"plugin:sonarjs/recommended"
],
"parserOptions": {
- "ecmaVersion": 2018
+ "ecmaVersion": "latest"
},
"plugins": [
"node",
(cookieHeader || '').split(/; */).forEach((field) => {
const [ name, value ] = common.splitFirst(field, '=', null).map((x) => x && decodeURIComponent(x.trim()));
if (name && !(name in cookie)) {
- if (value && value.startsWith('"') && value.endsWith('"')) {
+ if (value?.startsWith('"') && value.endsWith('"')) {
cookie[name] = value.slice(1, -1); // eslint-disable-line security/detect-object-injection
} else {
cookie[name] = value; // eslint-disable-line security/detect-object-injection
return o;
};
+/**
+ * Return a new object duplicating `o`, without the properties specified.
+ * @param {Object} o
+ * @param {String[]} props
+ * @returns {Object}
+ */
const omit = (o, props) => {
return Object.fromEntries(Object.entries(o).filter(([k]) => !props.includes(k)));
};
+/**
+ * Helper to log mystery-box statistics.
+ * @param {ConsoleLike} logger
+ * @param {String} scope
+ * @returns {Function}
+ */
const mysteryBoxLogger = (logger, scope) => {
return (s) => {
logger.debug(scope, `${s.packageName}@${s.packageVersion}:${s.method}`, omit(s, [
* @param {Number=} options.authenticator.inactiveSessionLifespanSeconds
* @param {Boolean} options.authenticator.secureAuthOnly
* @param {Object} options.dingus
- * @param {Object} options.dingus.proxyPrefix
- * @param {Object} options.dingus.selfBaseUrl
+ * @param {String} options.dingus.proxyPrefix
+ * @param {String} options.dingus.selfBaseUrl
*/
constructor(logger, authenticator, options) {
this.logger = logger;
&& me) {
let profile;
profile = await this.indieAuthCommunication.fetchProfile(me);
- if ((!profile || !profile.metadata)
+ if ((!profile?.metadata)
&& meAutoScheme) {
this.logger.debug(_scope, 'trying http fallback', { ctx });
me.protocol = 'http';
profile = await this.indieAuthCommunication.fetchProfile(me);
}
- if (!profile || !profile.metadata) {
+ if (!profile?.metadata) {
this.logger.debug(_scope, 'failed to find any profile information at url', { ctx });
ctx.errors.push(`No profile information was found at '${me}'.`);
} else {
"pam"
],
"engines": {
- "node": ">=14"
+ "node": "^14 >=14.18 || >=15.7"
},
"author": "Justin Wind <jwind-npm@squeep.com>",
"license": "ISC",