mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 17:57:36 +08:00
DISABLE_THIRD_PARTY_CHECK=NPM update R=jacktfranklin@chromium.org Bug: none Change-Id: I6bc8fd7e6f416ceae5e849ba3c4061887b940f07 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2692306 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
|
|
var _validators = _interopRequireDefault(require("../dist/validators"));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
// eslint-disable-next-line import/default
|
|
|
|
/**
|
|
* @param {string} schemaId
|
|
* @param {formatData~config} config
|
|
* @returns {undefined}
|
|
*/
|
|
const validateConfig = (schemaId, config = {}) => {
|
|
const validate = _validators.default[schemaId];
|
|
|
|
if (!validate(config)) {
|
|
const errors = validate.errors.map(error => {
|
|
return {
|
|
dataPath: error.dataPath,
|
|
message: error.message,
|
|
params: error.params,
|
|
schemaPath: error.schemaPath
|
|
};
|
|
});
|
|
/* eslint-disable no-console */
|
|
|
|
console.log('config', config);
|
|
console.log('errors', errors);
|
|
/* eslint-enable no-console */
|
|
|
|
throw new Error('Invalid config.');
|
|
}
|
|
};
|
|
|
|
var _default = validateConfig;
|
|
exports.default = _default;
|
|
//# sourceMappingURL=validateConfig.js.map
|