diff options
author | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-03-05 19:02:27 +0200 |
---|---|---|
committer | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-03-05 19:02:27 +0200 |
commit | 5d309ff52cd399a6b71968a6b9a70c8ac0b98981 (patch) | |
tree | 360f7eb50f956e2367ef38fa1fc6ac7ac5258042 /node_modules/jest-validate | |
parent | b500a50f1b97d93c98b36ed9a980f8188d648147 (diff) | |
download | LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.tar.gz LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.zip |
Added node_modules for the updating to work properly.
Diffstat (limited to 'node_modules/jest-validate')
30 files changed, 1544 insertions, 0 deletions
diff --git a/node_modules/jest-validate/LICENSE b/node_modules/jest-validate/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/jest-validate/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/jest-validate/README.md b/node_modules/jest-validate/README.md new file mode 100644 index 0000000..2406bd5 --- /dev/null +++ b/node_modules/jest-validate/README.md @@ -0,0 +1,196 @@ +# jest-validate + +Generic configuration validation tool that helps you with warnings, errors and deprecation messages as well as showing users examples of correct configuration. + +```bash +npm install --save jest-validate +``` + +## Usage + +```js +import {validate} from 'jest-validate'; + +validate(config, validationOptions); // => {hasDeprecationWarnings: boolean, isValid: boolean} +``` + +Where `ValidationOptions` are: + +```ts +type ValidationOptions = { + comment?: string; + condition?: (option: unknown, validOption: unknown) => boolean; + deprecate?: ( + config: Record<string, unknown>, + option: string, + deprecatedOptions: DeprecatedOptions, + options: ValidationOptions, + ) => boolean; + deprecatedConfig?: DeprecatedOptions; + error?: ( + option: string, + received: unknown, + defaultValue: unknown, + options: ValidationOptions, + path?: Array<string>, + ) => void; + exampleConfig: Record<string, unknown>; + recursive?: boolean; + recursiveBlacklist?: Array<string>; + recursiveDenylist?: Array<string>; + title?: Title; + unknown?: ( + config: Record<string, unknown>, + exampleConfig: Record<string, unknown>, + option: string, + options: ValidationOptions, + path?: Array<string>, + ) => void; +}; + +type Title = { + deprecation?: string; + error?: string; + warning?: string; +}; +``` + +`exampleConfig` is the only option required. + +## API + +By default `jest-validate` will print generic warning and error messages. You can however customize this behavior by providing `options: ValidationOptions` object as a second argument: + +Almost anything can be overwritten to suite your needs. + +### Options + +- `recursiveDenylist` – optional array of string keyPaths that should be excluded from deep (recursive) validation. +- `comment` – optional string to be rendered below error/warning message. +- `condition` – an optional function with validation condition. +- `deprecate`, `error`, `unknown` – optional functions responsible for displaying warning and error messages. +- `deprecatedConfig` – optional object with deprecated config keys. +- `exampleConfig` – the only **required** option with configuration against which you'd like to test. +- `recursive` - optional boolean determining whether recursively compare `exampleConfig` to `config` (default: `true`). +- `title` – optional object of titles for errors and messages. + +You will find examples of `condition`, `deprecate`, `error`, `unknown`, and `deprecatedConfig` inside source of this repository, named respectively. + +## exampleConfig syntax + +`exampleConfig` should be an object with key/value pairs that contain an example of a valid value for each key. A configuration value is considered valid when: + +- it matches the JavaScript type of the example value, e.g. `string`, `number`, `array`, `boolean`, `function`, or `object` +- it is `null` or `undefined` +- it matches the Javascript type of any of arguments passed to `MultipleValidOptions(...)` + +The last condition is a special syntax that allows validating where more than one type is permissible; see example below. It's acceptable to have multiple values of the same type in the example, so you can also use this syntax to provide more than one example. When a validation failure occurs, the error message will show all other values in the array as examples. + +## Examples + +Minimal example: + +```js +validate(config, {exampleConfig}); +``` + +Example with slight modifications: + +```js +validate(config, { + comment: ' Documentation: http://custom-docs.com', + deprecatedConfig, + exampleConfig, + title: { + deprecation: 'Custom Deprecation', + // leaving 'error' and 'warning' as default + }, +}); +``` + +This will output: + +#### Warning: + +```bash +● Validation Warning: + + Unknown option transformx with value "<rootDir>/node_modules/babel-jest" was found. + This is either a typing error or a user mistake. Fixing it will remove this message. + + Documentation: http://custom-docs.com +``` + +#### Error: + +```bash +● Validation Error: + + Option transform must be of type: + object + but instead received: + string + + Example: + { + "transform": { + "\\.js$": "<rootDir>/preprocessor.js" + } + } + + Documentation: http://custom-docs.com +``` + +## Example validating multiple types + +```js +import {multipleValidOptions} from 'jest-validate'; + +validate(config, { + // `bar` will accept either a string or a number + bar: multipleValidOptions('string is ok', 2), +}); +``` + +#### Error: + +```bash +● Validation Error: + + Option foo must be of type: + string or number + but instead received: + array + + Example: + { + "bar": "string is ok" + } + + or + + { + "bar": 2 + } + + Documentation: http://custom-docs.com +``` + +#### Deprecation + +Based on `deprecatedConfig` object with proper deprecation messages. Note custom title: + +```bash +Custom Deprecation: + + Option scriptPreprocessor was replaced by transform, which support multiple preprocessors. + + Jest now treats your current configuration as: + { + "transform": {".*": "xxx"} + } + + Please update your configuration. + + Documentation: http://custom-docs.com +``` diff --git a/node_modules/jest-validate/build/condition.d.ts b/node_modules/jest-validate/build/condition.d.ts new file mode 100644 index 0000000..4411c91 --- /dev/null +++ b/node_modules/jest-validate/build/condition.d.ts @@ -0,0 +1,9 @@ +/** + * 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. + */ +export declare function getValues<T = unknown>(validOption: T): Array<T>; +export declare function validationCondition(option: unknown, validOption: unknown): boolean; +export declare function multipleValidOptions<T extends Array<unknown>>(...args: T): T[number]; diff --git a/node_modules/jest-validate/build/condition.js b/node_modules/jest-validate/build/condition.js new file mode 100644 index 0000000..89bcc98 --- /dev/null +++ b/node_modules/jest-validate/build/condition.js @@ -0,0 +1,48 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.getValues = getValues; +exports.multipleValidOptions = multipleValidOptions; +exports.validationCondition = validationCondition; + +/** + * 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. + */ +const toString = Object.prototype.toString; +const MULTIPLE_VALID_OPTIONS_SYMBOL = Symbol('JEST_MULTIPLE_VALID_OPTIONS'); + +function validationConditionSingle(option, validOption) { + return ( + option === null || + option === undefined || + (typeof option === 'function' && typeof validOption === 'function') || + toString.call(option) === toString.call(validOption) + ); +} + +function getValues(validOption) { + if ( + Array.isArray(validOption) && // @ts-expect-error + validOption[MULTIPLE_VALID_OPTIONS_SYMBOL] + ) { + return validOption; + } + + return [validOption]; +} + +function validationCondition(option, validOption) { + return getValues(validOption).some(e => validationConditionSingle(option, e)); +} + +function multipleValidOptions(...args) { + const options = [...args]; // @ts-expect-error + + options[MULTIPLE_VALID_OPTIONS_SYMBOL] = true; + return options; +} diff --git a/node_modules/jest-validate/build/defaultConfig.d.ts b/node_modules/jest-validate/build/defaultConfig.d.ts new file mode 100644 index 0000000..fa3cba0 --- /dev/null +++ b/node_modules/jest-validate/build/defaultConfig.d.ts @@ -0,0 +1,9 @@ +/** + * 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. + */ +import type { ValidationOptions } from './types'; +declare const validationOptions: ValidationOptions; +export default validationOptions; diff --git a/node_modules/jest-validate/build/defaultConfig.js b/node_modules/jest-validate/build/defaultConfig.js new file mode 100644 index 0000000..e179c05 --- /dev/null +++ b/node_modules/jest-validate/build/defaultConfig.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _condition = require('./condition'); + +var _deprecated = require('./deprecated'); + +var _errors = require('./errors'); + +var _utils = require('./utils'); + +var _warnings = require('./warnings'); + +/** + * 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. + */ +const validationOptions = { + comment: '', + condition: _condition.validationCondition, + deprecate: _deprecated.deprecationWarning, + deprecatedConfig: {}, + error: _errors.errorMessage, + exampleConfig: {}, + recursive: true, + // Allow NPM-sanctioned comments in package.json. Use a "//" key. + recursiveDenylist: ['//'], + title: { + deprecation: _utils.DEPRECATION, + error: _utils.ERROR, + warning: _utils.WARNING + }, + unknown: _warnings.unknownOptionWarning +}; +var _default = validationOptions; +exports.default = _default; diff --git a/node_modules/jest-validate/build/deprecated.d.ts b/node_modules/jest-validate/build/deprecated.d.ts new file mode 100644 index 0000000..b8cf9e0 --- /dev/null +++ b/node_modules/jest-validate/build/deprecated.d.ts @@ -0,0 +1,8 @@ +/** + * 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. + */ +import type { DeprecatedOptions, ValidationOptions } from './types'; +export declare const deprecationWarning: (config: Record<string, unknown>, option: string, deprecatedOptions: DeprecatedOptions, options: ValidationOptions) => boolean; diff --git a/node_modules/jest-validate/build/deprecated.js b/node_modules/jest-validate/build/deprecated.js new file mode 100644 index 0000000..08be871 --- /dev/null +++ b/node_modules/jest-validate/build/deprecated.js @@ -0,0 +1,32 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.deprecationWarning = void 0; + +var _utils = require('./utils'); + +/** + * 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. + */ +const deprecationMessage = (message, options) => { + const comment = options.comment; + const name = + (options.title && options.title.deprecation) || _utils.DEPRECATION; + (0, _utils.logValidationWarning)(name, message, comment); +}; + +const deprecationWarning = (config, option, deprecatedOptions, options) => { + if (option in deprecatedOptions) { + deprecationMessage(deprecatedOptions[option](config), options); + return true; + } + + return false; +}; + +exports.deprecationWarning = deprecationWarning; diff --git a/node_modules/jest-validate/build/errors.d.ts b/node_modules/jest-validate/build/errors.d.ts new file mode 100644 index 0000000..564667b --- /dev/null +++ b/node_modules/jest-validate/build/errors.d.ts @@ -0,0 +1,8 @@ +/** + * 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. + */ +import type { ValidationOptions } from './types'; +export declare const errorMessage: (option: string, received: unknown, defaultValue: unknown, options: ValidationOptions, path?: string[] | undefined) => void; diff --git a/node_modules/jest-validate/build/errors.js b/node_modules/jest-validate/build/errors.js new file mode 100644 index 0000000..2468732 --- /dev/null +++ b/node_modules/jest-validate/build/errors.js @@ -0,0 +1,75 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.errorMessage = void 0; + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +function _jestGetType() { + const data = require('jest-get-type'); + + _jestGetType = function () { + return data; + }; + + return data; +} + +var _condition = require('./condition'); + +var _utils = require('./utils'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: 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. + */ +const errorMessage = (option, received, defaultValue, options, path) => { + const conditions = (0, _condition.getValues)(defaultValue); + const validTypes = Array.from( + new Set(conditions.map(_jestGetType().getType)) + ); + const message = ` Option ${_chalk().default.bold( + `"${path && path.length > 0 ? path.join('.') + '.' : ''}${option}"` + )} must be of type: + ${validTypes.map(e => _chalk().default.bold.green(e)).join(' or ')} + but instead received: + ${_chalk().default.bold.red((0, _jestGetType().getType)(received))} + + Example: +${formatExamples(option, conditions)}`; + const comment = options.comment; + const name = (options.title && options.title.error) || _utils.ERROR; + throw new _utils.ValidationError(name, message, comment); +}; + +exports.errorMessage = errorMessage; + +function formatExamples(option, examples) { + return examples.map( + e => ` { + ${_chalk().default.bold(`"${option}"`)}: ${_chalk().default.bold( + (0, _utils.formatPrettyObject)(e) + )} + }` + ).join(` + + or + +`); +} diff --git a/node_modules/jest-validate/build/exampleConfig.d.ts b/node_modules/jest-validate/build/exampleConfig.d.ts new file mode 100644 index 0000000..9df7c32 --- /dev/null +++ b/node_modules/jest-validate/build/exampleConfig.d.ts @@ -0,0 +1,9 @@ +/** + * 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. + */ +import type { ValidationOptions } from './types'; +declare const config: ValidationOptions; +export default config; diff --git a/node_modules/jest-validate/build/exampleConfig.js b/node_modules/jest-validate/build/exampleConfig.js new file mode 100644 index 0000000..1cc8620 --- /dev/null +++ b/node_modules/jest-validate/build/exampleConfig.js @@ -0,0 +1,36 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +/** + * 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. + */ +const config = { + comment: ' A comment', + condition: () => true, + deprecate: () => false, + deprecatedConfig: { + key: () => 'Deprecation message' + }, + error: () => {}, + exampleConfig: { + key: 'value', + test: 'case' + }, + recursive: true, + recursiveDenylist: [], + title: { + deprecation: 'Deprecation Warning', + error: 'Validation Error', + warning: 'Validation Warning' + }, + unknown: () => {} +}; +var _default = config; +exports.default = _default; diff --git a/node_modules/jest-validate/build/index.d.ts b/node_modules/jest-validate/build/index.d.ts new file mode 100644 index 0000000..86ae3ad --- /dev/null +++ b/node_modules/jest-validate/build/index.d.ts @@ -0,0 +1,11 @@ +/** + * 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. + */ +export { ValidationError, createDidYouMeanMessage, format, logValidationWarning, } from './utils'; +export type { DeprecatedOptions } from './types'; +export { default as validate } from './validate'; +export { default as validateCLIOptions } from './validateCLIOptions'; +export { multipleValidOptions } from './condition'; diff --git a/node_modules/jest-validate/build/index.js b/node_modules/jest-validate/build/index.js new file mode 100644 index 0000000..56c5bea --- /dev/null +++ b/node_modules/jest-validate/build/index.js @@ -0,0 +1,61 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +Object.defineProperty(exports, 'ValidationError', { + enumerable: true, + get: function () { + return _utils.ValidationError; + } +}); +Object.defineProperty(exports, 'createDidYouMeanMessage', { + enumerable: true, + get: function () { + return _utils.createDidYouMeanMessage; + } +}); +Object.defineProperty(exports, 'format', { + enumerable: true, + get: function () { + return _utils.format; + } +}); +Object.defineProperty(exports, 'logValidationWarning', { + enumerable: true, + get: function () { + return _utils.logValidationWarning; + } +}); +Object.defineProperty(exports, 'multipleValidOptions', { + enumerable: true, + get: function () { + return _condition.multipleValidOptions; + } +}); +Object.defineProperty(exports, 'validate', { + enumerable: true, + get: function () { + return _validate.default; + } +}); +Object.defineProperty(exports, 'validateCLIOptions', { + enumerable: true, + get: function () { + return _validateCLIOptions.default; + } +}); + +var _utils = require('./utils'); + +var _validate = _interopRequireDefault(require('./validate')); + +var _validateCLIOptions = _interopRequireDefault( + require('./validateCLIOptions') +); + +var _condition = require('./condition'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} diff --git a/node_modules/jest-validate/build/types.d.ts b/node_modules/jest-validate/build/types.d.ts new file mode 100644 index 0000000..9e8e106 --- /dev/null +++ b/node_modules/jest-validate/build/types.d.ts @@ -0,0 +1,26 @@ +/** + * 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. + */ +declare type Title = { + deprecation?: string; + error?: string; + warning?: string; +}; +export declare type DeprecatedOptionFunc = (arg: Record<string, unknown>) => string; +export declare type DeprecatedOptions = Record<string, DeprecatedOptionFunc>; +export declare type ValidationOptions = { + comment?: string; + condition?: (option: unknown, validOption: unknown) => boolean; + deprecate?: (config: Record<string, unknown>, option: string, deprecatedOptions: DeprecatedOptions, options: ValidationOptions) => boolean; + deprecatedConfig?: DeprecatedOptions; + error?: (option: string, received: unknown, defaultValue: unknown, options: ValidationOptions, path?: Array<string>) => void; + exampleConfig: Record<string, unknown>; + recursive?: boolean; + recursiveDenylist?: Array<string>; + title?: Title; + unknown?: (config: Record<string, unknown>, exampleConfig: Record<string, unknown>, option: string, options: ValidationOptions, path?: Array<string>) => void; +}; +export {}; diff --git a/node_modules/jest-validate/build/types.js b/node_modules/jest-validate/build/types.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/jest-validate/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/jest-validate/build/utils.d.ts b/node_modules/jest-validate/build/utils.d.ts new file mode 100644 index 0000000..e43e65c --- /dev/null +++ b/node_modules/jest-validate/build/utils.d.ts @@ -0,0 +1,18 @@ +/** + * 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. + */ +export declare const DEPRECATION: string; +export declare const ERROR: string; +export declare const WARNING: string; +export declare const format: (value: unknown) => string; +export declare const formatPrettyObject: (value: unknown) => string; +export declare class ValidationError extends Error { + name: string; + message: string; + constructor(name: string, message: string, comment?: string | null); +} +export declare const logValidationWarning: (name: string, message: string, comment?: string | null | undefined) => void; +export declare const createDidYouMeanMessage: (unrecognized: string, allowedOptions: Array<string>) => string; diff --git a/node_modules/jest-validate/build/utils.js b/node_modules/jest-validate/build/utils.js new file mode 100644 index 0000000..a451387 --- /dev/null +++ b/node_modules/jest-validate/build/utils.js @@ -0,0 +1,129 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.logValidationWarning = + exports.formatPrettyObject = + exports.format = + exports.createDidYouMeanMessage = + exports.WARNING = + exports.ValidationError = + exports.ERROR = + exports.DEPRECATION = + void 0; + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +function _leven() { + const data = _interopRequireDefault(require('leven')); + + _leven = function () { + return data; + }; + + return data; +} + +function _prettyFormat() { + const data = require('pretty-format'); + + _prettyFormat = function () { + return data; + }; + + return data; +} + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +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; +} + +const BULLET = _chalk().default.bold('\u25cf'); + +const DEPRECATION = `${BULLET} Deprecation Warning`; +exports.DEPRECATION = DEPRECATION; +const ERROR = `${BULLET} Validation Error`; +exports.ERROR = ERROR; +const WARNING = `${BULLET} Validation Warning`; +exports.WARNING = WARNING; + +const format = value => + typeof value === 'function' + ? value.toString() + : (0, _prettyFormat().format)(value, { + min: true + }); + +exports.format = format; + +const formatPrettyObject = value => + typeof value === 'function' + ? value.toString() + : JSON.stringify(value, null, 2).split('\n').join('\n '); + +exports.formatPrettyObject = formatPrettyObject; + +class ValidationError extends Error { + constructor(name, message, comment) { + super(); + + _defineProperty(this, 'name', void 0); + + _defineProperty(this, 'message', void 0); + + comment = comment ? '\n\n' + comment : '\n'; + this.name = ''; + this.message = _chalk().default.red( + _chalk().default.bold(name) + ':\n\n' + message + comment + ); + Error.captureStackTrace(this, () => {}); + } +} + +exports.ValidationError = ValidationError; + +const logValidationWarning = (name, message, comment) => { + comment = comment ? '\n\n' + comment : '\n'; + console.warn( + _chalk().default.yellow( + _chalk().default.bold(name) + ':\n\n' + message + comment + ) + ); +}; + +exports.logValidationWarning = logValidationWarning; + +const createDidYouMeanMessage = (unrecognized, allowedOptions) => { + const suggestion = allowedOptions.find(option => { + const steps = (0, _leven().default)(option, unrecognized); + return steps < 3; + }); + return suggestion + ? `Did you mean ${_chalk().default.bold(format(suggestion))}?` + : ''; +}; + +exports.createDidYouMeanMessage = createDidYouMeanMessage; diff --git a/node_modules/jest-validate/build/validate.d.ts b/node_modules/jest-validate/build/validate.d.ts new file mode 100644 index 0000000..24a49af --- /dev/null +++ b/node_modules/jest-validate/build/validate.d.ts @@ -0,0 +1,13 @@ +/** + * 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. + */ +import type { ValidationOptions } from './types'; +declare let hasDeprecationWarnings: boolean; +declare const validate: (config: Record<string, unknown>, options: ValidationOptions) => { + hasDeprecationWarnings: boolean; + isValid: boolean; +}; +export default validate; diff --git a/node_modules/jest-validate/build/validate.js b/node_modules/jest-validate/build/validate.js new file mode 100644 index 0000000..799a366 --- /dev/null +++ b/node_modules/jest-validate/build/validate.js @@ -0,0 +1,131 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _defaultConfig = _interopRequireDefault(require('./defaultConfig')); + +var _utils = require('./utils'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: 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, denylist) => + denylist ? denylist.includes([...path, key].join('.')) : false; + +const _validate = (config, exampleConfig, options, path = []) => { + if ( + typeof config !== 'object' || + config == null || + typeof exampleConfig !== 'object' || + exampleConfig == null + ) { + return { + hasDeprecationWarnings + }; + } + + for (const key in config) { + if ( + options.deprecatedConfig && + key in options.deprecatedConfig && + typeof options.deprecate === 'function' + ) { + const isDeprecatedKey = options.deprecate( + config, + key, + options.deprecatedConfig, + options + ); + hasDeprecationWarnings = hasDeprecationWarnings || isDeprecatedKey; + } else if (allowsMultipleTypes(key)) { + const value = config[key]; + + if ( + typeof options.condition === 'function' && + typeof options.error === 'function' + ) { + if (key === 'maxWorkers' && !isOfTypeStringOrNumber(value)) { + throw new _utils.ValidationError( + 'Validation Error', + `${key} has to be of type string or number`, + 'maxWorkers=50% or\nmaxWorkers=3' + ); + } + } + } else if (Object.hasOwnProperty.call(exampleConfig, key)) { + if ( + typeof options.condition === 'function' && + typeof options.error === 'function' && + !options.condition(config[key], exampleConfig[key]) + ) { + options.error(key, config[key], exampleConfig[key], options, path); + } + } else if ( + shouldSkipValidationForPath(path, key, options.recursiveDenylist) + ) { + // skip validating unknown options inside blacklisted paths + } else { + options.unknown && + options.unknown(config, exampleConfig, key, options, path); + } + + if ( + options.recursive && + !Array.isArray(exampleConfig[key]) && + options.recursiveDenylist && + !shouldSkipValidationForPath(path, key, options.recursiveDenylist) + ) { + _validate(config[key], exampleConfig[key], options, [...path, key]); + } + } + + return { + hasDeprecationWarnings + }; +}; + +const allowsMultipleTypes = key => key === 'maxWorkers'; + +const isOfTypeStringOrNumber = value => + typeof value === 'number' || typeof value === 'string'; + +const validate = (config, options) => { + hasDeprecationWarnings = false; // Preserve default denylist entries even with user-supplied denylist + + const combinedDenylist = [ + ...(_defaultConfig.default.recursiveDenylist || []), + ...(options.recursiveDenylist || []) + ]; + const defaultedOptions = Object.assign({ + ..._defaultConfig.default, + ...options, + recursiveDenylist: combinedDenylist, + title: options.title || _defaultConfig.default.title + }); + + const {hasDeprecationWarnings: hdw} = _validate( + config, + options.exampleConfig, + defaultedOptions + ); + + return { + hasDeprecationWarnings: hdw, + isValid: true + }; +}; + +var _default = validate; +exports.default = _default; diff --git a/node_modules/jest-validate/build/validateCLIOptions.d.ts b/node_modules/jest-validate/build/validateCLIOptions.d.ts new file mode 100644 index 0000000..e1e8102 --- /dev/null +++ b/node_modules/jest-validate/build/validateCLIOptions.d.ts @@ -0,0 +1,14 @@ +/** + * 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. + */ +import type { Options } from 'yargs'; +import type { Config } from '@jest/types'; +import type { DeprecatedOptions } from './types'; +export declare const DOCUMENTATION_NOTE: string; +export default function validateCLIOptions(argv: Config.Argv, options: { + deprecationEntries: DeprecatedOptions; + [s: string]: Options; +}, rawArgv?: Array<string>): boolean; diff --git a/node_modules/jest-validate/build/validateCLIOptions.js b/node_modules/jest-validate/build/validateCLIOptions.js new file mode 100644 index 0000000..3356d7e --- /dev/null +++ b/node_modules/jest-validate/build/validateCLIOptions.js @@ -0,0 +1,141 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.DOCUMENTATION_NOTE = void 0; +exports.default = validateCLIOptions; + +function _camelcase() { + const data = _interopRequireDefault(require('camelcase')); + + _camelcase = function () { + return data; + }; + + return data; +} + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +var _defaultConfig = _interopRequireDefault(require('./defaultConfig')); + +var _deprecated = require('./deprecated'); + +var _utils = require('./utils'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: 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. + */ +const BULLET = _chalk().default.bold('\u25cf'); + +const DOCUMENTATION_NOTE = ` ${_chalk().default.bold( + 'CLI Options Documentation:' +)} + https://jestjs.io/docs/cli +`; +exports.DOCUMENTATION_NOTE = DOCUMENTATION_NOTE; + +const createCLIValidationError = (unrecognizedOptions, allowedOptions) => { + let title = `${BULLET} Unrecognized CLI Parameter`; + let message; + const comment = + ` ${_chalk().default.bold('CLI Options Documentation')}:\n` + + ' https://jestjs.io/docs/cli\n'; + + if (unrecognizedOptions.length === 1) { + const unrecognized = unrecognizedOptions[0]; + const didYouMeanMessage = + unrecognized.length > 1 + ? (0, _utils.createDidYouMeanMessage)( + unrecognized, + Array.from(allowedOptions) + ) + : ''; + message = + ` Unrecognized option ${_chalk().default.bold( + (0, _utils.format)(unrecognized) + )}.` + (didYouMeanMessage ? ` ${didYouMeanMessage}` : ''); + } else { + title += 's'; + message = + ' Following options were not recognized:\n' + + ` ${_chalk().default.bold((0, _utils.format)(unrecognizedOptions))}`; + } + + return new _utils.ValidationError(title, message, comment); +}; + +const logDeprecatedOptions = (deprecatedOptions, deprecationEntries, argv) => { + deprecatedOptions.forEach(opt => { + (0, _deprecated.deprecationWarning)(argv, opt, deprecationEntries, { + ..._defaultConfig.default, + comment: DOCUMENTATION_NOTE + }); + }); +}; + +function validateCLIOptions(argv, options, rawArgv = []) { + const yargsSpecialOptions = ['$0', '_', 'help', 'h']; + const deprecationEntries = options.deprecationEntries || {}; + const allowedOptions = Object.keys(options).reduce( + (acc, option) => acc.add(option).add(options[option].alias || option), + new Set(yargsSpecialOptions) + ); + const unrecognizedOptions = Object.keys(argv).filter( + arg => + !allowedOptions.has( + (0, _camelcase().default)(arg, { + locale: 'en-US' + }) + ) && + !allowedOptions.has(arg) && + (!rawArgv.length || rawArgv.includes(arg)), + [] + ); + + if (unrecognizedOptions.length) { + throw createCLIValidationError(unrecognizedOptions, allowedOptions); + } + + const CLIDeprecations = Object.keys(deprecationEntries).reduce( + (acc, entry) => { + if (options[entry]) { + acc[entry] = deprecationEntries[entry]; + const alias = options[entry].alias; + + if (alias) { + acc[alias] = deprecationEntries[entry]; + } + } + + return acc; + }, + {} + ); + const deprecations = new Set(Object.keys(CLIDeprecations)); + const deprecatedOptions = Object.keys(argv).filter( + arg => deprecations.has(arg) && argv[arg] != null + ); + + if (deprecatedOptions.length) { + logDeprecatedOptions(deprecatedOptions, CLIDeprecations, argv); + } + + return true; +} diff --git a/node_modules/jest-validate/build/warnings.d.ts b/node_modules/jest-validate/build/warnings.d.ts new file mode 100644 index 0000000..70ff76c --- /dev/null +++ b/node_modules/jest-validate/build/warnings.d.ts @@ -0,0 +1,8 @@ +/** + * 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. + */ +import type { ValidationOptions } from './types'; +export declare const unknownOptionWarning: (config: Record<string, unknown>, exampleConfig: Record<string, unknown>, option: string, options: ValidationOptions, path?: string[] | undefined) => void; diff --git a/node_modules/jest-validate/build/warnings.js b/node_modules/jest-validate/build/warnings.js new file mode 100644 index 0000000..e87b95a --- /dev/null +++ b/node_modules/jest-validate/build/warnings.js @@ -0,0 +1,48 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.unknownOptionWarning = void 0; + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +var _utils = require('./utils'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: 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. + */ +const unknownOptionWarning = (config, exampleConfig, option, options, path) => { + const didYouMean = (0, _utils.createDidYouMeanMessage)( + option, + Object.keys(exampleConfig) + ); + const message = + ` Unknown option ${_chalk().default.bold( + `"${path && path.length > 0 ? path.join('.') + '.' : ''}${option}"` + )} with value ${_chalk().default.bold( + (0, _utils.format)(config[option]) + )} was found.` + + (didYouMean && ` ${didYouMean}`) + + '\n This is probably a typing mistake. Fixing it will remove this message.'; + const comment = options.comment; + const name = (options.title && options.title.warning) || _utils.WARNING; + (0, _utils.logValidationWarning)(name, message, comment); +}; + +exports.unknownOptionWarning = unknownOptionWarning; diff --git a/node_modules/jest-validate/node_modules/camelcase/index.d.ts b/node_modules/jest-validate/node_modules/camelcase/index.d.ts new file mode 100644 index 0000000..9db94e5 --- /dev/null +++ b/node_modules/jest-validate/node_modules/camelcase/index.d.ts @@ -0,0 +1,103 @@ +declare namespace camelcase { + interface Options { + /** + Uppercase the first character: `foo-bar` → `FooBar`. + + @default false + */ + readonly pascalCase?: boolean; + + /** + Preserve the consecutive uppercase characters: `foo-BAR` → `FooBAR`. + + @default false + */ + readonly preserveConsecutiveUppercase?: boolean; + + /** + The locale parameter indicates the locale to be used to convert to upper/lower case according to any locale-specific case mappings. If multiple locales are given in an array, the best available locale is used. + + Setting `locale: false` ignores the platform locale and uses the [Unicode Default Case Conversion](https://unicode-org.github.io/icu/userguide/transforms/casemappings.html#simple-single-character-case-mapping) algorithm. + + Default: The host environment’s current locale. + + @example + ``` + import camelCase = require('camelcase'); + + camelCase('lorem-ipsum', {locale: 'en-US'}); + //=> 'loremIpsum' + camelCase('lorem-ipsum', {locale: 'tr-TR'}); + //=> 'loremİpsum' + camelCase('lorem-ipsum', {locale: ['en-US', 'en-GB']}); + //=> 'loremIpsum' + camelCase('lorem-ipsum', {locale: ['tr', 'TR', 'tr-TR']}); + //=> 'loremİpsum' + ``` + */ + readonly locale?: false | string | readonly string[]; + } +} + +/** +Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`. + +Correctly handles Unicode strings. + +@param input - String to convert to camel case. + +@example +``` +import camelCase = require('camelcase'); + +camelCase('foo-bar'); +//=> 'fooBar' + +camelCase('foo_bar'); +//=> 'fooBar' + +camelCase('Foo-Bar'); +//=> 'fooBar' + +camelCase('розовый_пушистый_единорог'); +//=> 'розовыйПушистыйЕдинорог' + +camelCase('Foo-Bar', {pascalCase: true}); +//=> 'FooBar' + +camelCase('--foo.bar', {pascalCase: false}); +//=> 'fooBar' + +camelCase('Foo-BAR', {preserveConsecutiveUppercase: true}); +//=> 'fooBAR' + +camelCase('fooBAR', {pascalCase: true, preserveConsecutiveUppercase: true})); +//=> 'FooBAR' + +camelCase('foo bar'); +//=> 'fooBar' + +console.log(process.argv[3]); +//=> '--foo-bar' +camelCase(process.argv[3]); +//=> 'fooBar' + +camelCase(['foo', 'bar']); +//=> 'fooBar' + +camelCase(['__foo__', '--bar'], {pascalCase: true}); +//=> 'FooBar' + +camelCase(['foo', 'BAR'], {pascalCase: true, preserveConsecutiveUppercase: true}) +//=> 'FooBAR' + +camelCase('lorem-ipsum', {locale: 'en-US'}); +//=> 'loremIpsum' +``` +*/ +declare function camelcase( + input: string | readonly string[], + options?: camelcase.Options +): string; + +export = camelcase; diff --git a/node_modules/jest-validate/node_modules/camelcase/index.js b/node_modules/jest-validate/node_modules/camelcase/index.js new file mode 100644 index 0000000..6ff4ee8 --- /dev/null +++ b/node_modules/jest-validate/node_modules/camelcase/index.js @@ -0,0 +1,113 @@ +'use strict'; + +const UPPERCASE = /[\p{Lu}]/u; +const LOWERCASE = /[\p{Ll}]/u; +const LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu; +const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u; +const SEPARATORS = /[_.\- ]+/; + +const LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source); +const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu'); +const NUMBERS_AND_IDENTIFIER = new RegExp('\\d+' + IDENTIFIER.source, 'gu'); + +const preserveCamelCase = (string, toLowerCase, toUpperCase) => { + let isLastCharLower = false; + let isLastCharUpper = false; + let isLastLastCharUpper = false; + + for (let i = 0; i < string.length; i++) { + const character = string[i]; + + if (isLastCharLower && UPPERCASE.test(character)) { + string = string.slice(0, i) + '-' + string.slice(i); + isLastCharLower = false; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = true; + i++; + } else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character)) { + string = string.slice(0, i - 1) + '-' + string.slice(i - 1); + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = false; + isLastCharLower = true; + } else { + isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character; + } + } + + return string; +}; + +const preserveConsecutiveUppercase = (input, toLowerCase) => { + LEADING_CAPITAL.lastIndex = 0; + + return input.replace(LEADING_CAPITAL, m1 => toLowerCase(m1)); +}; + +const postProcess = (input, toUpperCase) => { + SEPARATORS_AND_IDENTIFIER.lastIndex = 0; + NUMBERS_AND_IDENTIFIER.lastIndex = 0; + + return input.replace(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier)) + .replace(NUMBERS_AND_IDENTIFIER, m => toUpperCase(m)); +}; + +const camelCase = (input, options) => { + if (!(typeof input === 'string' || Array.isArray(input))) { + throw new TypeError('Expected the input to be `string | string[]`'); + } + + options = { + pascalCase: false, + preserveConsecutiveUppercase: false, + ...options + }; + + if (Array.isArray(input)) { + input = input.map(x => x.trim()) + .filter(x => x.length) + .join('-'); + } else { + input = input.trim(); + } + + if (input.length === 0) { + return ''; + } + + const toLowerCase = options.locale === false ? + string => string.toLowerCase() : + string => string.toLocaleLowerCase(options.locale); + const toUpperCase = options.locale === false ? + string => string.toUpperCase() : + string => string.toLocaleUpperCase(options.locale); + + if (input.length === 1) { + return options.pascalCase ? toUpperCase(input) : toLowerCase(input); + } + + const hasUpperCase = input !== toLowerCase(input); + + if (hasUpperCase) { + input = preserveCamelCase(input, toLowerCase, toUpperCase); + } + + input = input.replace(LEADING_SEPARATORS, ''); + + if (options.preserveConsecutiveUppercase) { + input = preserveConsecutiveUppercase(input, toLowerCase); + } else { + input = toLowerCase(input); + } + + if (options.pascalCase) { + input = toUpperCase(input.charAt(0)) + input.slice(1); + } + + return postProcess(input, toUpperCase); +}; + +module.exports = camelCase; +// TODO: Remove this for the next major release +module.exports.default = camelCase; diff --git a/node_modules/jest-validate/node_modules/camelcase/license b/node_modules/jest-validate/node_modules/camelcase/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/node_modules/jest-validate/node_modules/camelcase/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/jest-validate/node_modules/camelcase/package.json b/node_modules/jest-validate/node_modules/camelcase/package.json new file mode 100644 index 0000000..c433579 --- /dev/null +++ b/node_modules/jest-validate/node_modules/camelcase/package.json @@ -0,0 +1,44 @@ +{ + "name": "camelcase", + "version": "6.3.0", + "description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`", + "license": "MIT", + "repository": "sindresorhus/camelcase", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=10" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "camelcase", + "camel-case", + "camel", + "case", + "dash", + "hyphen", + "dot", + "underscore", + "separator", + "string", + "text", + "convert", + "pascalcase", + "pascal-case" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.11.0", + "xo": "^0.28.3" + } +} diff --git a/node_modules/jest-validate/node_modules/camelcase/readme.md b/node_modules/jest-validate/node_modules/camelcase/readme.md new file mode 100644 index 0000000..0ff8f9e --- /dev/null +++ b/node_modules/jest-validate/node_modules/camelcase/readme.md @@ -0,0 +1,144 @@ +# camelcase + +> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar` + +Correctly handles Unicode strings. + +If you use this on untrusted user input, don't forget to limit the length to something reasonable. + +## Install + +``` +$ npm install camelcase +``` + +*If you need to support Firefox < 78, stay on version 5 as version 6 uses regex features not available in Firefox < 78.* + +## Usage + +```js +const camelCase = require('camelcase'); + +camelCase('foo-bar'); +//=> 'fooBar' + +camelCase('foo_bar'); +//=> 'fooBar' + +camelCase('Foo-Bar'); +//=> 'fooBar' + +camelCase('розовый_пушистый_единорог'); +//=> 'розовыйПушистыйЕдинорог' + +camelCase('Foo-Bar', {pascalCase: true}); +//=> 'FooBar' + +camelCase('--foo.bar', {pascalCase: false}); +//=> 'fooBar' + +camelCase('Foo-BAR', {preserveConsecutiveUppercase: true}); +//=> 'fooBAR' + +camelCase('fooBAR', {pascalCase: true, preserveConsecutiveUppercase: true})); +//=> 'FooBAR' + +camelCase('foo bar'); +//=> 'fooBar' + +console.log(process.argv[3]); +//=> '--foo-bar' +camelCase(process.argv[3]); +//=> 'fooBar' + +camelCase(['foo', 'bar']); +//=> 'fooBar' + +camelCase(['__foo__', '--bar'], {pascalCase: true}); +//=> 'FooBar' + +camelCase(['foo', 'BAR'], {pascalCase: true, preserveConsecutiveUppercase: true}) +//=> 'FooBAR' + +camelCase('lorem-ipsum', {locale: 'en-US'}); +//=> 'loremIpsum' +``` + +## API + +### camelCase(input, options?) + +#### input + +Type: `string | string[]` + +String to convert to camel case. + +#### options + +Type: `object` + +##### pascalCase + +Type: `boolean`\ +Default: `false` + +Uppercase the first character: `foo-bar` → `FooBar` + +##### preserveConsecutiveUppercase + +Type: `boolean`\ +Default: `false` + +Preserve the consecutive uppercase characters: `foo-BAR` → `FooBAR`. + +##### locale + +Type: `false | string | string[]`\ +Default: The host environment’s current locale. + +The locale parameter indicates the locale to be used to convert to upper/lower case according to any locale-specific case mappings. If multiple locales are given in an array, the best available locale is used. + +```js +const camelCase = require('camelcase'); + +camelCase('lorem-ipsum', {locale: 'en-US'}); +//=> 'loremIpsum' + +camelCase('lorem-ipsum', {locale: 'tr-TR'}); +//=> 'loremİpsum' + +camelCase('lorem-ipsum', {locale: ['en-US', 'en-GB']}); +//=> 'loremIpsum' + +camelCase('lorem-ipsum', {locale: ['tr', 'TR', 'tr-TR']}); +//=> 'loremİpsum' +``` + +Setting `locale: false` ignores the platform locale and uses the [Unicode Default Case Conversion](https://unicode-org.github.io/icu/userguide/transforms/casemappings.html#simple-single-character-case-mapping) algorithm: + +```js +const camelCase = require('camelcase'); + +// On a platform with 'tr-TR' + +camelCase('lorem-ipsum'); +//=> 'loremİpsum' + +camelCase('lorem-ipsum', {locale: false}); +//=> 'loremIpsum' +``` + +## camelcase for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of camelcase and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-camelcase?utm_source=npm-camelcase&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + +## Related + +- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module +- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase +- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string +- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one +- [camelcase-keys](https://github.com/sindresorhus/camelcase-keys) - Convert object keys to camel case diff --git a/node_modules/jest-validate/package.json b/node_modules/jest-validate/package.json new file mode 100644 index 0000000..8336ebd --- /dev/null +++ b/node_modules/jest-validate/package.json @@ -0,0 +1,37 @@ +{ + "name": "jest-validate", + "version": "27.5.1", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/jest-validate" + }, + "license": "MIT", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "@jest/types": "^27.5.1", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^27.5.1", + "leven": "^3.1.0", + "pretty-format": "^27.5.1" + }, + "devDependencies": { + "@types/yargs": "^16.0.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} |