Socket
Socket
Sign inDemoInstall

jest-validate

Package Overview
Dependencies
Maintainers
5
Versions
219
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-validate - npm Package Compare versions

Comparing version 21.0.0-alpha.2 to 21.0.0-beta.1

46

build/default_config.js

@@ -1,2 +0,2 @@

'use strict';
'use strict';var _deprecated;

@@ -13,29 +13,29 @@

var _deprecated = require('./deprecated');
var _warnings = require('./warnings');
var _errors = require('./errors');
var _example_config = require('./example_config');var _example_config2 = _interopRequireDefault(_example_config);
var _condition = require('./condition');var _condition2 = _interopRequireDefault(_condition);
var _utils = require('./utils');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
function _load_deprecated() {return _deprecated = require('./deprecated');}var _warnings;
function _load_warnings() {return _warnings = require('./warnings');}var _errors;
function _load_errors() {return _errors = require('./errors');}var _example_config;
function _load_example_config() {return _example_config = _interopRequireDefault(require('./example_config'));}var _condition;
function _load_condition() {return _condition = _interopRequireDefault(require('./condition'));}var _utils;
function _load_utils() {return _utils = require('./utils');}function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
module.exports = {
comment: '',
condition: _condition2.default,
deprecate: _deprecated.deprecationWarning,
condition: (_condition || _load_condition()).default,
deprecate: (_deprecated || _load_deprecated()).deprecationWarning,
deprecatedConfig: {},
error: _errors.errorMessage,
exampleConfig: _example_config2.default,
error: (_errors || _load_errors()).errorMessage,
exampleConfig: (_example_config || _load_example_config()).default,
title: {
deprecation: _utils.DEPRECATION,
error: _utils.ERROR,
warning: _utils.WARNING },
deprecation: (_utils || _load_utils()).DEPRECATION,
error: (_utils || _load_utils()).ERROR,
warning: (_utils || _load_utils()).WARNING },
unknown: _warnings.unknownOptionWarning }; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
unknown: (_warnings || _load_warnings()).unknownOptionWarning }; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/

@@ -1,2 +0,2 @@

'use strict';
'use strict';var _utils;

@@ -13,11 +13,11 @@

var _utils = require('./utils'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/const deprecationMessage = (message, options) => {const comment = options.comment;const name = options.title && options.title.deprecation || _utils.DEPRECATION;(0, _utils.logValidationWarning)(name, message, comment);};
function _load_utils() {return _utils = require('./utils');} /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/const deprecationMessage = (message, options) => {const comment = options.comment;const name = options.title && options.title.deprecation || (_utils || _load_utils()).DEPRECATION;(0, (_utils || _load_utils()).logValidationWarning)(name, message, comment);};
const deprecationWarning = (

@@ -24,0 +24,0 @@ config,

@@ -1,2 +0,2 @@

'use strict';
'use strict';var _chalk;

@@ -13,30 +13,30 @@

var _chalk = require('chalk');var _chalk2 = _interopRequireDefault(_chalk);
var _jestGetType = require('jest-get-type');var _jestGetType2 = _interopRequireDefault(_jestGetType);
var _utils = require('./utils');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/const errorMessage = (option, received, defaultValue, options) => {const message = ` Option ${_chalk2.default.bold(`"${option}"`)} must be of type:
${_chalk2.default.bold.green((0, _jestGetType2.default)(defaultValue))}
function _load_chalk() {return _chalk = _interopRequireDefault(require('chalk'));}var _jestGetType;
function _load_jestGetType() {return _jestGetType = _interopRequireDefault(require('jest-get-type'));}var _utils;
function _load_utils() {return _utils = require('./utils');}function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/const errorMessage = (option, received, defaultValue, options) => {const message = ` Option ${(_chalk || _load_chalk()).default.bold(`"${option}"`)} must be of type:
${(_chalk || _load_chalk()).default.bold.green((0, (_jestGetType || _load_jestGetType()).default)(defaultValue))}
but instead received:
${_chalk2.default.bold.red((0, _jestGetType2.default)(received))}
${(_chalk || _load_chalk()).default.bold.red((0, (_jestGetType || _load_jestGetType()).default)(received))}
Example:
{
${_chalk2.default.bold(`"${option}"`)}: ${_chalk2.default.bold((0, _utils.format)(defaultValue))}
${(_chalk || _load_chalk()).default.bold(`"${option}"`)}: ${(_chalk || _load_chalk()).default.bold((0, (_utils || _load_utils()).format)(defaultValue))}
}`;
const comment = options.comment;
const name = options.title && options.title.error || _utils.ERROR;
const name = options.title && options.title.error || (_utils || _load_utils()).ERROR;
throw new _utils.ValidationError(name, message, comment);
throw new (_utils || _load_utils()).ValidationError(name, message, comment);
};
module.exports = {
ValidationError: _utils.ValidationError,
ValidationError: (_utils || _load_utils()).ValidationError,
errorMessage };

@@ -1,2 +0,2 @@

'use strict';
'use strict';var _utils;

@@ -11,19 +11,19 @@

var _utils = require('./utils');
var _errors = require('./errors');
var _validate = require('./validate');var _validate2 = _interopRequireDefault(_validate);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
function _load_utils() {return _utils = require('./utils');}var _errors;
function _load_errors() {return _errors = require('./errors');}var _validate;
function _load_validate() {return _validate = _interopRequireDefault(require('./validate'));}function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
module.exports = {
ValidationError: _errors.ValidationError,
createDidYouMeanMessage: _utils.createDidYouMeanMessage,
format: _utils.format,
logValidationWarning: _utils.logValidationWarning,
validate: _validate2.default }; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
ValidationError: (_errors || _load_errors()).ValidationError,
createDidYouMeanMessage: (_utils || _load_utils()).createDidYouMeanMessage,
format: (_utils || _load_utils()).format,
logValidationWarning: (_utils || _load_utils()).logValidationWarning,
validate: (_validate || _load_validate()).default }; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/

@@ -1,2 +0,2 @@

'use strict';
'use strict';var _chalk;

@@ -11,15 +11,15 @@

var _chalk = require('chalk');var _chalk2 = _interopRequireDefault(_chalk);
var _prettyFormat = require('pretty-format');var _prettyFormat2 = _interopRequireDefault(_prettyFormat);
var _leven = require('leven');var _leven2 = _interopRequireDefault(_leven);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
function _load_chalk() {return _chalk = _interopRequireDefault(require('chalk'));}var _prettyFormat;
function _load_prettyFormat() {return _prettyFormat = _interopRequireDefault(require('pretty-format'));}var _leven;
function _load_leven() {return _leven = _interopRequireDefault(require('leven'));}function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
const BULLET = _chalk2.default.bold('\u25cf'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/const DEPRECATION = `${BULLET} Deprecation Warning`;const ERROR = `${BULLET} Validation Error`;const WARNING = `${BULLET} Validation Warning`;const format = value => typeof value === 'function' ? value.toString() : (0, _prettyFormat2.default)(value, { min: true });
const BULLET = (_chalk || _load_chalk()).default.bold('\u25cf'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/const DEPRECATION = `${BULLET} Deprecation Warning`;const ERROR = `${BULLET} Validation Error`;const WARNING = `${BULLET} Validation Warning`;const format = value => typeof value === 'function' ? value.toString() : (0, (_prettyFormat || _load_prettyFormat()).default)(value, { min: true });

@@ -34,3 +34,3 @@ class ValidationError extends Error {

this.name = '';
this.message = _chalk2.default.red(_chalk2.default.bold(name) + ':\n\n' + message + comment);
this.message = (_chalk || _load_chalk()).default.red((_chalk || _load_chalk()).default.bold(name) + ':\n\n' + message + comment);
Error.captureStackTrace(this, () => {});

@@ -46,3 +46,3 @@ }}

comment = comment ? '\n\n' + comment : '\n';
console.warn(_chalk2.default.yellow(_chalk2.default.bold(name) + ':\n\n' + message + comment));
console.warn((_chalk || _load_chalk()).default.yellow((_chalk || _load_chalk()).default.bold(name) + ':\n\n' + message + comment));
};

@@ -55,7 +55,7 @@

const suggestion = allowedOptions.find(option => {
const steps = (0, _leven2.default)(option, unrecognized);
const steps = (0, (_leven || _load_leven()).default)(option, unrecognized);
return steps < 3;
});
return suggestion ? `Did you mean ${_chalk2.default.bold(format(suggestion))}?` : '';
return suggestion ? `Did you mean ${(_chalk || _load_chalk()).default.bold(format(suggestion))}?` : '';
};

@@ -62,0 +62,0 @@

@@ -1,2 +0,2 @@

'use strict';
'use strict';var _default_config;

@@ -13,11 +13,11 @@

var _default_config = require('./default_config');var _default_config2 = _interopRequireDefault(_default_config);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/const _validate = (config, options) => {let hasDeprecationWarnings = false;for (const key in config) {if (options.deprecatedConfig && key in options.deprecatedConfig &&
function _load_default_config() {return _default_config = _interopRequireDefault(require('./default_config'));}function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/const _validate = (config, options) => {let hasDeprecationWarnings = false;for (const key in config) {if (options.deprecatedConfig && key in options.deprecatedConfig &&
typeof options.deprecate === 'function')

@@ -51,9 +51,9 @@ {

const validate = (config, options) => {
_validate(options, _default_config2.default); // validate against jest-validate config
_validate(options, (_default_config || _load_default_config()).default); // validate against jest-validate config
const defaultedOptions = Object.assign(
{}, _default_config2.default,
{}, (_default_config || _load_default_config()).default,
options,
{ title: Object.assign({}, _default_config2.default.title, options.title) });var _validate2 =
{ title: Object.assign({}, (_default_config || _load_default_config()).default.title, options.title) });var _validate2 =

@@ -60,0 +60,0 @@

@@ -1,2 +0,2 @@

'use strict';
'use strict';var _chalk;

@@ -13,4 +13,4 @@

var _chalk = require('chalk');var _chalk2 = _interopRequireDefault(_chalk);
var _utils = require('./utils');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
function _load_chalk() {return _chalk = _interopRequireDefault(require('chalk'));}var _utils;
function _load_utils() {return _utils = require('./utils');}function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}

@@ -28,3 +28,3 @@

{
const didYouMean = (0, _utils.createDidYouMeanMessage)(
const didYouMean = (0, (_utils || _load_utils()).createDidYouMeanMessage)(
option,

@@ -34,4 +34,4 @@ Object.keys(exampleConfig));

const message =
` Unknown option ${_chalk2.default.bold(`"${option}"`)} with value ${_chalk2.default.bold(
(0, _utils.format)(config[option]))
` Unknown option ${(_chalk || _load_chalk()).default.bold(`"${option}"`)} with value ${(_chalk || _load_chalk()).default.bold(
(0, (_utils || _load_utils()).format)(config[option]))
} was found.` + (

@@ -42,5 +42,5 @@ didYouMean && ` ${didYouMean}`) +

const comment = options.comment;
const name = options.title && options.title.warning || _utils.WARNING;
const name = options.title && options.title.warning || (_utils || _load_utils()).WARNING;
(0, _utils.logValidationWarning)(name, message, comment);
(0, (_utils || _load_utils()).logValidationWarning)(name, message, comment);
}; /**

@@ -47,0 +47,0 @@ * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.

{
"name": "jest-validate",
"version": "21.0.0-alpha.2",
"version": "21.0.0-beta.1",
"repository": {

@@ -12,6 +12,6 @@ "type": "git",

"chalk": "^2.0.1",
"jest-get-type": "21.0.0-alpha.2",
"jest-get-type": "21.0.0-beta.1",
"leven": "^2.1.0",
"pretty-format": "21.0.0-alpha.2"
"pretty-format": "21.0.0-beta.1"
}
}
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