Socket
Socket
Sign inDemoInstall

@humanwhocodes/config-array

Package Overview
Dependencies
7
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.12.3 to 0.13.0

48

api.js

@@ -176,9 +176,15 @@ 'use strict';

*/
constructor(name, index, source) {
super(`Config ${name}: ${source.message}`, { cause: source });
constructor(name, index, { cause, message }) {
const finalMessage = message || cause.message;
super(`Config ${name}: ${finalMessage}`, { cause });
// copy over custom properties that aren't represented
for (const key of Object.keys(source)) {
if (!(key in this)) {
this[key] = source[key];
if (cause) {
for (const key of Object.keys(cause)) {
if (!(key in this)) {
this[key] = cause[key];
}
}

@@ -209,3 +215,3 @@ }

function getConfigName(config) {
if (typeof config.name === 'string' && config.name) {
if (config && typeof config.name === 'string' && config.name) {
return `"${config.name}"`;

@@ -217,3 +223,2 @@ }

/**

@@ -241,4 +246,5 @@ * Rethrows a config error with additional information about the config object.

/**
* Creates a function that asserts that the files and ignores keys
* of a config object are valid as per base schema.
* Creates a function that asserts that the config is valid
* during normalization. This checks that the config is not nullish
* and that files and ignores keys of a config object are valid as per base schema.
* @param {Object} config The config object to check.

@@ -249,8 +255,16 @@ * @param {number} index The index of the config object in the array.

*/
function assertValidFilesAndIgnores(config, index) {
function assertValidBaseConfig(config, index) {
if (!config || typeof config !== 'object') {
return;
if (config === null) {
throw new ConfigError(getConfigName(config), index, { message: 'Unexpected null config.' });
}
if (config === undefined) {
throw new ConfigError(getConfigName(config), index, { message: 'Unexpected undefined config.' });
}
if (typeof config !== 'object') {
throw new ConfigError(getConfigName(config), index, { message: 'Unexpected non-object config.' });
}
const validateConfig = { };

@@ -269,3 +283,3 @@

} catch (validationError) {
rethrowConfigError(config, index, validationError);
rethrowConfigError(config, index, { cause: validationError });
}

@@ -766,3 +780,3 @@ }

this.push(...normalizedConfigs.map(this[ConfigArraySymbol.preprocessConfig].bind(this)));
this.forEach(assertValidFilesAndIgnores);
this.forEach(assertValidBaseConfig);
this[ConfigArraySymbol.isNormalized] = true;

@@ -789,3 +803,3 @@

this.push(...normalizedConfigs.map(this[ConfigArraySymbol.preprocessConfig].bind(this)));
this.forEach(assertValidFilesAndIgnores);
this.forEach(assertValidBaseConfig);
this[ConfigArraySymbol.isNormalized] = true;

@@ -1026,3 +1040,3 @@

} catch (validationError) {
rethrowConfigError(this[index], index, validationError);
rethrowConfigError(this[index], index, { cause: validationError});
}

@@ -1029,0 +1043,0 @@ }, {}, this);

{
"name": "@humanwhocodes/config-array",
"version": "0.12.3",
"version": "0.13.0",
"description": "Glob-based configuration matching.",

@@ -5,0 +5,0 @@ "author": "Nicholas C. Zakas",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc