Updating NPM dependencies
This commit is contained in:
83
node_modules/jest-validate/build/validate.js
generated
vendored
83
node_modules/jest-validate/build/validate.js
generated
vendored
@@ -13,42 +13,16 @@ function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _objectSpread(target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === 'function') {
|
||||
ownKeys = ownKeys.concat(
|
||||
Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
})
|
||||
);
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
let hasDeprecationWarnings = false;
|
||||
|
||||
const shouldSkipValidationForPath = (path, key, blacklist) =>
|
||||
blacklist ? blacklist.includes([...path, key].join('.')) : false;
|
||||
const shouldSkipValidationForPath = (path, key, denylist) =>
|
||||
denylist ? denylist.includes([...path, key].join('.')) : false;
|
||||
|
||||
const _validate = (config, exampleConfig, options, path = []) => {
|
||||
if (
|
||||
@@ -99,7 +73,11 @@ const _validate = (config, exampleConfig, options, path = []) => {
|
||||
options.error(key, config[key], exampleConfig[key], options, path);
|
||||
}
|
||||
} else if (
|
||||
shouldSkipValidationForPath(path, key, options.recursiveBlacklist)
|
||||
shouldSkipValidationForPath(
|
||||
path,
|
||||
key,
|
||||
options.recursiveDenylist || options.recursiveBlacklist
|
||||
)
|
||||
) {
|
||||
// skip validating unknown options inside blacklisted paths
|
||||
} else {
|
||||
@@ -110,8 +88,12 @@ const _validate = (config, exampleConfig, options, path = []) => {
|
||||
if (
|
||||
options.recursive &&
|
||||
!Array.isArray(exampleConfig[key]) &&
|
||||
options.recursiveBlacklist &&
|
||||
!shouldSkipValidationForPath(path, key, options.recursiveBlacklist)
|
||||
(options.recursiveDenylist || options.recursiveBlacklist) &&
|
||||
!shouldSkipValidationForPath(
|
||||
path,
|
||||
key,
|
||||
options.recursiveDenylist || options.recursiveBlacklist
|
||||
)
|
||||
) {
|
||||
_validate(config[key], exampleConfig[key], options, [...path, key]);
|
||||
}
|
||||
@@ -128,21 +110,24 @@ const isOfTypeStringOrNumber = value =>
|
||||
typeof value === 'number' || typeof value === 'string';
|
||||
|
||||
const validate = (config, options) => {
|
||||
hasDeprecationWarnings = false; // Preserve default blacklist entries even with user-supplied blacklist
|
||||
hasDeprecationWarnings = false; // Preserve default denylist entries even with user-supplied denylist
|
||||
|
||||
const combinedBlacklist = [
|
||||
...(_defaultConfig.default.recursiveBlacklist || []),
|
||||
...(options.recursiveBlacklist || [])
|
||||
const combinedDenylist = [
|
||||
...(_defaultConfig.default.recursiveDenylist || []),
|
||||
...(options.recursiveDenylist || options.recursiveBlacklist || [])
|
||||
];
|
||||
const defaultedOptions = Object.assign(
|
||||
_objectSpread({}, _defaultConfig.default, options, {
|
||||
recursiveBlacklist: combinedBlacklist,
|
||||
title: options.title || _defaultConfig.default.title
|
||||
})
|
||||
);
|
||||
const defaultedOptions = Object.assign({
|
||||
..._defaultConfig.default,
|
||||
...options,
|
||||
recursiveDenylist: combinedDenylist,
|
||||
title: options.title || _defaultConfig.default.title
|
||||
});
|
||||
|
||||
const _validate2 = _validate(config, options.exampleConfig, defaultedOptions),
|
||||
hdw = _validate2.hasDeprecationWarnings;
|
||||
const {hasDeprecationWarnings: hdw} = _validate(
|
||||
config,
|
||||
options.exampleConfig,
|
||||
defaultedOptions
|
||||
);
|
||||
|
||||
return {
|
||||
hasDeprecationWarnings: hdw,
|
||||
|
||||
Reference in New Issue
Block a user