diff --git a/package.json b/package.json index 7fa2de48..a8fcfd61 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,36 @@ "author": "Salesforce", "license": "BSD-3-Clause", "types": "lib/index.d.ts", + "exports": { + "./duration": { + "require": "./lib/duration.js", + "import": "./lib/duration.js", + "types": "./lib/duration.d.ts" + }, + "./collections": { + "require": "./lib/collections.js", + "import": "./lib/collections.js", + "types": "./lib/collections.d.ts" + }, + "./creatable": { + "require": "./lib/createable.js", + "import": "./lib/createable.js", + "types": "./lib/createable.d.ts" + }, + "./env": { + "require": "./lib/env.js", + "import": "./lib/env.js", + "types": "./lib/env.d.ts" + }, + ".": { + "require": "./lib/index.js", + "import": "./lib/index.js", + "types": "./lib/index.d.ts" + } + }, "files": [ "lib/**/*.js", - "lib/**/*.d.ts", - "vendor/lodash.js" + "lib/**/*.d.ts" ], "scripts": { "build": "wireit", @@ -22,7 +48,6 @@ "link-check": "wireit", "lint": "wireit", "lint-fix": "yarn sf-lint --fix", - "lodash": "./scripts/build-lodash.sh", "prepack": "sf-prepack", "prepare": "sf-install", "test": "wireit", @@ -34,7 +59,6 @@ }, "devDependencies": { "@salesforce/dev-scripts": "^8.1.2", - "lodash-cli": "^4.17.5", "ts-node": "^10.9.2", "typescript": "^5.3.3" }, diff --git a/scripts/build-lodash.sh b/scripts/build-lodash.sh deleted file mode 100755 index 31323dc0..00000000 --- a/scripts/build-lodash.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -fns=( - 'defaults' - 'findKey' - 'keyBy' - 'includes' - 'mapKeys' - 'minBy' - 'maxBy' - 'merge' - 'omit' - 'once' - 'set' - 'sortBy' - 'toNumber' -) - -list=$(printf ",%s" "${fns[@]}") -list=${list:1} -union=$(printf "|'%s'" "${fns[@]}") -union=${union:1} - -node_modules/.bin/lodash exports=node include="$list" -o vendor/lodash.js -mv vendor/lodash.min.js vendor/lodash.js diff --git a/src/duration.ts b/src/duration.ts index 64d5d36d..27a5463f 100644 --- a/src/duration.ts +++ b/src/duration.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Optional } from '@salesforce/ts-types'; +import type { Optional } from '@salesforce/ts-types'; /** * A simple utility class for converting durations between minutes, seconds, and milliseconds. @@ -14,35 +14,29 @@ export class Duration { /** * The number of milliseconds in one second. */ - public static readonly MILLIS_IN_SECONDS: number = 1000; + public static readonly MILLIS_IN_SECONDS = 1000; /** * The number of seconds in one minute. */ - public static readonly SECONDS_IN_MINUTE: number = 60; + public static readonly SECONDS_IN_MINUTE = 60; /** * The number of minutes in one hour. */ - public static readonly MINUTES_IN_HOUR: number = 60; + public static readonly MINUTES_IN_HOUR = 60; /** * The number of hours in one day. */ - public static readonly HOURS_IN_DAY: number = 24; + public static readonly HOURS_IN_DAY = 24; /** * The number of days in one week. */ - public static readonly DAYS_IN_WEEK: number = 7; + public static readonly DAYS_IN_WEEK = 7; - public readonly quantity: number; - public readonly unit: Duration.Unit; - - public constructor(quantity: number, unit: Duration.Unit = Duration.Unit.MINUTES) { - this.quantity = quantity; - this.unit = unit; - } + public constructor(public quantity: number, public unit: Duration.Unit = Duration.Unit.MINUTES) {} /** * Returns the current number of minutes represented by this `Duration` instance, rounded to the nearest integer diff --git a/src/env.ts b/src/env.ts index 62f10064..ce6bedbc 100644 --- a/src/env.ts +++ b/src/env.ts @@ -5,16 +5,15 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { definiteEntriesOf, Dictionary, isKeyOf, KeyValue, Nullable, Optional, isNumber } from '@salesforce/ts-types'; -import { InvalidDefaultEnvValueError } from './errors'; -import { toNumber, toBoolean } from './nodash'; +import { definiteEntriesOf, Dictionary, KeyValue, Nullable, Optional } from '@salesforce/ts-types'; +import { toBoolean } from './shared/functions'; /** * An injectable abstraction on top of `process.env` with various convenience functions * for accessing environment variables of different anticipated shapes. */ export class Env { - public constructor(private store: Dictionary = process?.env || {}) { + public constructor(private store: Dictionary = process?.env ?? {}) { this.store = store; } @@ -36,122 +35,6 @@ export class Env { return this.store[key] ?? def; } - /** - * Gets a `string` value from a finite set of expected values, matched case-insensitively. - * - * @param key The name of the envar. - * @param values The finite set of expected values. - */ - public getStringIn(key: string, values: string[]): Optional; - /** - * Gets a `string` value from a finite set of expected values, matched case-insensitively, using a default if - * not found. - * - * @param key The name of the envar. - * @param values The finite set of expected values. - * @param def A default value. - * @throws {@link InvalidDefaultEnvValueError} If the provided default value is not a member of the expected set. - */ - public getStringIn(key: string, values: string[], def: string): string; - // underlying method - public getStringIn(key: string, values: string[], def?: string): Optional { - const re = new RegExp(values.join('|'), 'i'); - if (def && !re.test(def.toString())) { - const valueAsString = values.join(', '); - throw new InvalidDefaultEnvValueError(`${def} is not a member of ${valueAsString}`); - } - const value = this.getString(key); - if (!value) return def; - return re.test(value) ? value : def; - } - - /** - * Gets a `string` value from a finite set of expected values derived from the keys of a given object of type `T`, - * matched case-insensitively. An optional `transform` may be provided that will preprocess both the found value - * and any provided default before testing for membership in the target object's key set. - * - * @param key The name of the envar. - * @param obj The object providing the keys to test with. - * @param transform A transform function applied to both the default and value before testing that - * either is a key of `T`. - * - * ``` - * enum Mode { TEST = 'test', DEMO = 'demo' } - * env.setString('MY_ENVAR', Mode.DEMO); - * const check = env.getString('MY_ENVAR'); - * // check -> 'demo' - * // typeof check -> string - * const value = env.getKeyOf('MY_ENVAR', Mode, v => v.toUpperCase()); - * // value -> 'DEMO' - * // typeof value -> 'TEST' | 'DEMO' (i.e. Extract) - * const enumValue = Mode[value]; - * // enumValue -> 'demo' - * // typeof enumValue -> Mode - * ``` - */ - public getKeyOf>( - key: string, - obj: T, - transform?: (k: string) => string - ): Optional>; - /** - * Gets a `string` value from a finite set of expected values derived from the keys of a given object of type `T`, - * matched case-insensitively, using a default if not found. An optional `transform` may be provided that will - * preprocess both the found value and any provided default before testing for membership in the target object's - * key set. - * - * @param key The name of the envar. - * @param obj The object providing the keys to test with. - * @param def A default value. - * @param transform A transform function applied to both the default and value before testing that - * either is a key of `T`. - * @param {@link InvalidDefaultEnvValueError} If the provided default value is not a member of the expected set. - * - * ``` - * enum Mode { TEST = 'test', DEMO = 'demo' } - * env.setString('MY_ENVAR', Mode.DEMO); - * const check = env.getString('MY_ENVAR'); - * // check -> 'demo' - * // typeof check -> string - * const value = env.getKeyOf('MY_ENVAR', Mode, Mode.TEST, v => v.toUpperCase()); - * // value -> 'DEMO' - * // typeof value -> 'TEST' | 'DEMO' (Extract) - * const enumValue = Mode[value]; - * // enumValue -> 'demo' - * // typeof enumValue -> Mode - * ``` - */ - public getKeyOf>( - key: string, - obj: T, - def: string, - transform?: (k: string) => string - ): Extract; - // underlying method - public getKeyOf>( - key: string, - obj: T, - defOrTransform?: string | ((k: string) => string), - transform?: (k: string) => string - ): Optional> { - let value: Optional; - let def: Optional; - if (typeof defOrTransform === 'function') { - transform = defOrTransform; - } else { - def = defOrTransform; - } - if (def === undefined) { - value = this.getStringIn(key, Object.keys(obj)); - } else { - if (transform) def = transform(def); - value = this.getStringIn(key, Object.keys(obj), def); - } - if (!value) return; - if (typeof transform === 'function') value = transform(value); - if (isKeyOf(obj, value)) return value; - } - /** * Sets a `string` value for a given key, or removes the current value when no value is given. * @@ -166,40 +49,6 @@ export class Env { this.store[key] = value; } - /** - * Gets a list of `string` values for a given key by splitting the raw value on `,` chars. - * - * @param key The name of the envar. - */ - public getList(key: string): Optional; - /** - * Gets a list of `string` values for a given key by splitting the raw value on `,` chars. - * - * @param key The name of the envar. - * @param def A default list of values. - */ - public getList(key: string, def: string[]): string[]; - // underlying method - public getList(key: string, def?: string[]): Optional { - const value = this.getString(key); - return value ? value.split(',') : def; - } - - /** - * Sets a `string` value from a list for a given key by joining values with a `,` into a raw `string` value, - * or removes the current value when no value is given. - * - * @param key The name of the envar. - * @param values The values to set. - */ - public setList(key: string, values: Nullable): void { - if (values == null) { - this.unset(key); - return; - } - this.setString(key, values.join(',')); - } - /** * Gets a `boolean` value for a given key. Returns the default value if no value was found. * @@ -236,10 +85,10 @@ export class Env { public getNumber(key: string, def?: number | undefined): Optional { const value = this.getString(key); if (value) { - const num = toNumber(value); - return isNaN(num) && isNumber(def) ? def : num; + const num = Number(value); + return isNaN(num) && typeof def === 'number' ? def : num; } - return isNumber(def) ? def : undefined; + return typeof def === 'number' ? def : undefined; } /** @@ -253,7 +102,7 @@ export class Env { this.unset(key); return; } - this.setString(key, isNumber(value) ? String(value) : value); + this.setString(key, typeof value === 'number' ? String(value) : value); } /** diff --git a/src/errors.ts b/src/errors.ts index 92fa3cc4..538a9d9d 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -81,25 +81,13 @@ export class JsonParseError extends NamedError { } private static format(cause: Error, path?: string, line?: number, errorPortion?: string): string { - if (line == null) return cause.message || 'Unknown cause'; + if (line == null) return cause.message ?? 'Unknown cause'; return `Parse error in file ${path ?? 'unknown'} on line ${line}\n${errorPortion ?? cause.message}`; } } -export class JsonStringifyError extends NamedError { - public constructor(cause: Error) { - super('JsonStringifyError', cause); - } -} - export class JsonDataFormatError extends NamedError { public constructor(message: string) { super('JsonDataFormatError', message); } } - -export class InvalidDefaultEnvValueError extends NamedError { - public constructor(message: string) { - super('InvalidDefaultEnvValueError', message); - } -} diff --git a/src/index.ts b/src/index.ts index f31eea31..19129284 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,7 +10,6 @@ export * from './duration'; export * from './env'; export * from './errors'; export * from './json'; -export * from './nodash'; export * from './collections'; export * from './throttledPromiseAll'; export * from './settleAll'; diff --git a/src/json.ts b/src/json.ts index cb774091..afadc491 100644 --- a/src/json.ts +++ b/src/json.ts @@ -5,17 +5,8 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { - AnyJson, - isBoolean, - isJsonArray, - isJsonMap, - isNumber, - isString, - JsonMap, - Optional, -} from '@salesforce/ts-types'; -import { JsonDataFormatError, JsonParseError, JsonStringifyError } from './errors'; +import { AnyJson, isJsonArray, isJsonMap, JsonMap, Optional } from '@salesforce/ts-types'; +import { JsonDataFormatError, JsonParseError } from './errors'; /** * Parse JSON `string` data. @@ -77,27 +68,6 @@ export function parseJsonMap(data: string, jsonPath return json as T; // apply the requested type assertion } -/** - * Perform a deep clone of an object or array compatible with JSON stringification. - * Object fields that are not compatible with stringification will be omitted. Array - * entries that are not compatible with stringification will be censored as `null`. - * - * @param obj A JSON-compatible object or array to clone. - * @throws {@link JsonStringifyError} If the object contains circular references or causes - * other JSON stringification errors. - */ -// eslint-disable-next-line @typescript-eslint/ban-types -export function cloneJson(obj: T): T { - try { - return JSON.parse(JSON.stringify(obj)) as T; - } catch (err) { - if (err instanceof SyntaxError || err instanceof TypeError) { - throw new JsonStringifyError(err); - } - throw err; - } -} - /** * Finds all elements of type `T` with a given name in a `JsonMap`. Not suitable for use * with object graphs containing circular references. The specification of an appropriate @@ -128,9 +98,9 @@ export function getJsonValuesByName(json: JsonMap, * @param value The value search for. */ export function jsonIncludes(json: Optional, value: Optional): boolean { - if (json == null || value === undefined || isNumber(json) || isBoolean(json)) return false; + if (json == null || value === undefined || typeof json === 'number' || typeof json === 'boolean') return false; if (isJsonMap(json)) return Object.values(json).includes(value); if (isJsonArray(json)) return json.includes(value); - if (isString(value)) return json.includes(value); + if (typeof value === 'string') return json.includes(value); return false; } diff --git a/src/nodash/.eslintrc b/src/nodash/.eslintrc deleted file mode 100644 index fe8426a4..00000000 --- a/src/nodash/.eslintrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../.eslintrc.cjs", - "rules": { - "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/no-unsafe-member-access": "off", - "@typescript-eslint/no-unsafe-return": "off" - } -} diff --git a/src/nodash/external.ts b/src/nodash/external.ts deleted file mode 100644 index 65db7ef0..00000000 --- a/src/nodash/external.ts +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -// NOTE TO MAINTAINERS: -// -// This module exports replacements for several lodash functions with a much smaller footprint than relying -// on a full lodash build, or a partial build plus full lodash typings would provide. The downside is that -// in order to expand on this set, we must do the following: -// -// * Update scripts/build-lodash.sh with the new target function name. -// * Rebuild and commit the resulting vendor/lodash.js file using `yarn lodash`. -// * Manually copy, prune, and edit (if necessary) the new fn's typings from the lodash typing. -// * Add tests that verify the expected type signatures... at a minimum, add tests for the relevant fn examples -// published in the lodash documentation for that fn. - -import { AnyFunction, Dictionary, Many, Nullable, Optional } from '@salesforce/ts-types'; -/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */ -// @ts-ignore ignore the demand for typings for the locally built lodash -import * as _ from '../../vendor/lodash'; -import { ListIteratee, NumericDictionary, ObjectIteratee, Omit, ValueIteratee, ValueIterateeCustom } from './support'; - -/** - * Assigns own enumerable properties of source object(s) to the destination object for all destination - * properties that resolve to undefined. Once a property is set, additional values of the same property are - * ignored. - * - * Note: This method mutates `obj`. - * - * @param obj The destination object. - * @param sources The source objects. - */ -export function defaults(obj: T, source: S): S & T; -/** - * @see defaults - */ -export function defaults(obj: T, source1: S1, source2: S2): S2 & S1 & T; -/** - * @see defaults - */ -export function defaults(obj: T, source1: S1, source2: S2, source3: S3): S3 & S2 & S1 & T; -/** - * @see defaults - */ -export function defaults( - obj: T, - source1: S1, - source2: S2, - source3: S3, - source4: S4 -): S4 & S3 & S2 & S1 & T; -/** - * @see defaults - */ -export function defaults(obj: T): T; -// underlying function -export function defaults(obj: unknown, ...otherArgs: unknown[]): unknown { - return _.defaults(obj, ...otherArgs); -} - -/** - * This method is like `find` except that it returns the key of the first element predicate returns truthy for - * instead of the element itself. - * - * @param obj The object to search. - * @param predicate The function invoked per iteration. - */ -export function findKey(obj: Nullable, predicate?: ObjectIteratee): Optional { - return _.findKey(obj, predicate); -} - -/** - * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, - * it’s used as the offset from the end of collection. - * - * @param collection The collection to search. - * @param target The value to search for. - * @param fromIndex The index to search from. - */ -export function includes( - collection: Nullable | Dictionary | NumericDictionary>, - target: T, - fromIndex?: number -): boolean { - return _.includes(collection, target, fromIndex); -} - -/** - * Creates an object composed of keys generated from the results of running each element of collection through - * iteratee. The corresponding value of each key is the last element responsible for generating the key. The - * iteratee function is invoked with one argument: (value). - * - * @param collection The collection to iterate over. - * @param iteratee The function invoked per iteration. - */ -export function keyBy( - collection: Nullable>, - iteratee?: ValueIterateeCustom -): Dictionary; -/** - * @see keyBy - */ -export function keyBy( - collection: Nullable, - iteratee?: ValueIterateeCustom -): Dictionary; -// underlying function -export function keyBy(collection: unknown, iteratee?: unknown): unknown { - return _.keyBy(collection, iteratee); -} - -/** - * This method creates an object with the same values as object and keys generated - * by running each own enumerable property of object through iteratee. - * - * @param obj The object to iterate over. - * @param iteratee The function invoked per iteration. - */ -export function mapKeys(object: Nullable>, iteratee?: ListIteratee): Dictionary; -/** - * @see mapKeys - */ -export function mapKeys(object: Nullable, iteratee?: ObjectIteratee): Dictionary; -// underlying function -export function mapKeys(obj: unknown, iteratee?: unknown): unknown { - return _.mapKeys(obj, iteratee); -} - -/** - * This method is like `_.min` except that it accepts `iteratee` which is - * invoked for each element in `array` to generate the criterion by which - * the value is ranked. The iteratee is invoked with one argument: (value). - * - * @param array The array to iterate over. - * @param iteratee The iteratee invoked per element. - */ -export function minBy(collection: Nullable>, iteratee?: ValueIteratee): Optional { - return _.minBy(collection, iteratee); -} - -/** - * This method is like `_.max` except that it accepts `iteratee` which is - * invoked for each element in `array` to generate the criterion by which - * the value is ranked. The iteratee is invoked with one argument: (value). - * - * @param array The array to iterate over. - * @param iteratee The iteratee invoked per element. - */ -export function maxBy(collection: Nullable>, iteratee?: ValueIteratee): Optional { - return _.maxBy(collection, iteratee); -} - -/** - * Recursively merges own and inherited enumerable properties of source - * objects into the destination object, skipping source properties that resolve - * to `undefined`. Array and plain object properties are merged recursively. - * Other objects and value types are overridden by assignment. Source objects - * are applied from left to right. Subsequent sources overwrite property - * assignments of previous sources. - * - * **Note:** This method mutates `object`. - * - * @param object The destination object. - * @param sources The source objects. - */ -export function merge(object: T, source: S): T & S; -/** - * @see merge - */ -export function merge(object: T, source1: S1, source2: S2): T & S1 & S2; -/** - * @see merge - */ -export function merge(object: T, source1: S1, source2: S2, source3: S3): T & S1 & S2 & S3; -/** - * @see merge - */ -export function merge( - object: T, - source1: S1, - source2: S2, - source3: S3, - source4: S4 -): T & S1 & S2 & S3 & S4; -// underlying function -export function merge(obj: unknown, ...otherArgs: unknown[]): unknown { - return _.merge(obj, ...otherArgs); -} - -/** - * The opposite of `_.pick`; this method creates an object composed of the - * own and inherited enumerable properties of `object` that are not omitted. - * - * @param obj The source object. - * @param paths The property names to omit, specified individually or in arrays.. - */ -export function omit>(obj: Nullable, ...paths: Array>): T; -/** - * @see omit - */ -export function omit(obj: Nullable, ...paths: Array>): Omit; -/** - * @see omit - */ -export function omit(obj: Nullable, ...paths: Array>): Partial; -// underlying function -export function omit(obj: unknown, ...paths: unknown[]): unknown { - return _.omit(obj, ...paths); -} - -/** - * Creates a function that is restricted to invoking `func` once. Repeat calls to the function return the value - * of the first call. The `func` is invoked with the this binding and arguments of the created function. - * - * @param func The function to restrict. - */ -export function once(func: T): T { - return _.once(func); -} - -/** - * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for - * missing index properties while objects are created for all other missing properties. Use _.setWith to - * customize path creation. - * - * @param obj The object to modify. - * @param path The path of the property to set. - * @param value The value to set. - */ -export function set(obj: T, path: string, value: unknown): T; -/** - * @see set - */ -export function set(obj: object, path: string, value: unknown): R; -// underlying function -export function set(obj: unknown, path: string, value: unknown): unknown { - return _.set(obj, path, value); -} - -/** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection through each iteratee. This method - * performs a stable sort, that is, it preserves the original sort order of - * equal elements. The iteratees are invoked with one argument: (value). - * - * @param collection The collection to iterate over. - * @param iteratees The iteratees to sort by, specified individually or in arrays. - */ -export function sortBy(collection: Nullable>, ...iteratees: Array>>): T[]; -/** - * @see sortBy - */ -export function sortBy( - collection: Nullable, - ...iteratees: Array>> -): Array; -// underlying function -export function sortBy(collection: unknown, ...iteratees: unknown[]): unknown { - return _.sortBy(collection, ...iteratees); -} - -/** - * Converts `value` to a number. - * - * @param value The value to process. - * - * ``` - * _.toNumber(3); - * // => 3 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3'); - * // => 3 - * ``` - */ -export function toNumber(value: unknown): number { - return _.toNumber(value); -} diff --git a/src/nodash/index.ts b/src/nodash/index.ts deleted file mode 100644 index b67ff58d..00000000 --- a/src/nodash/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -export * from './external'; -export * from './internal'; diff --git a/src/nodash/internal.ts b/src/nodash/internal.ts deleted file mode 100644 index 88efaa7b..00000000 --- a/src/nodash/internal.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { hasNumber, isArrayLike, isBoolean, isNumber, isObject, Optional } from '@salesforce/ts-types'; - -/** - * Checks if value is empty. A value is considered empty unless it’s an arguments object, array, string, or - * jQuery-like collection with a length greater than 0 or an object with own enumerable properties. - * - * @param value The value to inspect. - */ -export function isEmpty(value: unknown): boolean { - if (value == null) return true; - if (isNumber(value)) return false; - if (isBoolean(value)) return false; - if (isArrayLike(value) && value.length > 0) return false; - if (hasNumber(value, 'size') && value.size > 0) return false; - if (isObject(value) && Object.keys(value).length > 0) return false; - return true; -} - -/** - * Converts the first character of `string` to lower case. - * - * @param string The string to convert. - */ -export function lowerFirst(value: string): string; -/** - * @see lowerFirst - */ -export function lowerFirst(value?: string): Optional; -// underlying function -export function lowerFirst(value?: string): Optional { - return value && value.charAt(0).toLowerCase() + value.slice(1); -} - -/** - * Formats a camel case style `string` into a title case. - * - * @param text Text to transform. - */ -export function camelCaseToTitleCase(text: string): string { - return text - .replace(/(^\w|\s\w)/g, (m) => m.toUpperCase()) - .replace(/([A-Z][a-z]+)/g, ' $1') - .replace(/\s{2,}/g, ' ') - .trim(); -} - -/** - * Converts string to snake case. - * - * @param str The string to convert. - */ -export function snakeCase(str: string): string; -export function snakeCase(str?: string): Optional; -// underlying function -export function snakeCase(str?: string): Optional { - return str - ?.replace(/([a-z])([A-Z])/g, '$1_$2') - .toLowerCase() - .replace(/\W/g, '_') - .replace(/^_+|_+$/g, ''); -} - -/** - * Converts the first character of `string` to upper case. - * - * @param string The string to convert. - */ -export function upperFirst(value: string): string; -/** - * @see upperFirst - */ -export function upperFirst(value?: string): Optional; -// underlying function -export function upperFirst(value?: string): Optional { - return value && value.charAt(0).toUpperCase() + value.slice(1); -} - -/** - * Converts value to a boolean. - * - * @param value The value to convert - * @returns boolean - */ -export function toBoolean(value: unknown): boolean { - switch (typeof value) { - case 'boolean': - return value; - case 'string': - return value.toLowerCase() === 'true' || value === '1'; - default: - return false; - } -} diff --git a/src/nodash/support.ts b/src/nodash/support.ts deleted file mode 100644 index 2d9d9cbb..00000000 --- a/src/nodash/support.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -// Support types specific to lodash constructs -- not intended for general reuse. -export type NotVoid = {} | null | undefined; -export type ValueIterateeCustom = ((value: T) => R) | IterateeShorthand; -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export type IterateeShorthand = PropertyKey | [PropertyKey, any] | PartialDeep; -export type PartialDeep = { [P in keyof T]?: PartialDeep }; -export type ObjectIterator = (value: NonNullable, key: string, collection: T) => R; -export type ObjectIteratee = ObjectIterator | IterateeShorthand; -export type ListIterator = (value: T, index: number, collection: ArrayLike) => R; -export type ListIteratee = ListIterator | IterateeShorthand; -export type ValueIteratee = ((value: T) => NotVoid) | IterateeShorthand; -export type Omit = Pick< - T, - ({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never })[keyof T] ->; -export type NumericDictionary = { [key: number]: T }; diff --git a/src/shared/functions.ts b/src/shared/functions.ts new file mode 100644 index 00000000..b159ff77 --- /dev/null +++ b/src/shared/functions.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2023, salesforce.com, inc. + * All rights reserved. + * Licensed under the BSD 3-Clause license. + * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause + */ + +/** + * Converts value to a boolean. + * + * @param value The value to convert + * @returns boolean + */ +export function toBoolean(value: unknown): boolean { + switch (typeof value) { + case 'boolean': + return value; + case 'string': + return value.toLowerCase() === 'true' || value === '1'; + default: + return false; + } +} diff --git a/test/env.test.ts b/test/env.test.ts index a13176e5..9f4ac579 100644 --- a/test/env.test.ts +++ b/test/env.test.ts @@ -7,7 +7,6 @@ import { expect } from 'chai'; import { Env } from '../src/env'; -import { InvalidDefaultEnvValueError } from '../src/errors'; describe('Env', () => { let env: Env; @@ -34,85 +33,11 @@ describe('Env', () => { expect(env.getString('FOO2', 'BAR')).to.equal('BAR'); }); - it('should get a string envar from a known set of values', () => { - expect(env.getStringIn('SET', ['a', 'b'])).to.equal('a'); - }); - - it('should get a string envar from a known set of values from an enum with differently cased keys', () => { - enum Expected { - A, - B, - } - expect(env.getStringIn('SET3', Object.keys(Expected))).to.equal('b'); - }); - - it('should get undefined given an invalid member of a known set of values', () => { - expect(env.getStringIn('SET2', ['a', 'b'])).to.be.undefined; - }); - - it('should get a default given an invalid member of a known set of values', () => { - expect(env.getStringIn('SET2', ['a', 'b'], 'b')).to.equal('b'); - }); - - it('should not throw given an valid default with different casing from the known set of values', () => { - expect(env.getStringIn('SET2', ['a', 'b', 'c'], 'C')).to.equal('c'); - }); - - it('should throw given an invalid default and an invalid member of a known set of values', () => { - expect(() => env.getStringIn('SET2', ['a', 'b'], 'c')).to.throw(InvalidDefaultEnvValueError); - }); - - it('should get a string envar as a key of an object', () => { - const obj = { BAR: 'TEST' }; - const value = env.getKeyOf('FOO', obj); - expect(value).to.equal('BAR'); - }); - - it('should get a string envar as a key of an object, with a transform', () => { - const obj = { bar: 'TEST' }; - const value = env.getKeyOf('FOO', obj, (v) => v.toLowerCase()); - expect(value).to.equal('bar'); - }); - - it('should get a string envar as a key of an enum, with a transform', () => { - enum Mode { - TEST = 'test', - DEMO = 'demo', - } - const value = env.getKeyOf('ENUM', Mode, Mode.DEMO, (v) => v.toUpperCase()); - expect(value).to.equal('TEST'); - expect(Mode[value]).to.equal(Mode.TEST); - }); - - it('should get a default for an undefined envar from an enum, with a transform', () => { - enum Mode { - TEST = 'test', - DEMO = 'demo', - } - const value = env.getKeyOf('ENUM2', Mode, Mode.DEMO, (v) => v.toUpperCase()); - expect(value).to.equal('DEMO'); - expect(Mode[value]).to.equal(Mode.DEMO); - }); - it('should set a string envar', () => { env.setString('FOO2', 'BAR2'); expect(env.getString('FOO2')).to.equal('BAR2'); }); - it('should get a list envar', () => { - expect(env.getList('LIST')).to.deep.equal(['a', 'b', 'c']); - }); - - it('should set a list envar', () => { - env.setList('LIST2', ['a', 'b', 'c', 'd']); - expect(env.getList('LIST2')).to.deep.equal(['a', 'b', 'c', 'd']); - }); - - it('should unset a list envar implicitly', () => { - env.setList('LIST2', undefined); - expect(env.getList('LIST2')).to.be.undefined; - }); - it('should delete a string envar explicitly', () => { env.unset('FOO'); expect(env.getString('FOO')).to.be.undefined; diff --git a/test/json.test.ts b/test/json.test.ts index 15f2f2be..80dad36f 100644 --- a/test/json.test.ts +++ b/test/json.test.ts @@ -5,9 +5,9 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Dictionary, JsonMap } from '@salesforce/ts-types'; +import { JsonMap } from '@salesforce/ts-types'; import { expect } from 'chai'; -import { JsonDataFormatError, JsonParseError, JsonStringifyError } from '../src/errors'; +import { JsonDataFormatError, JsonParseError } from '../src/errors'; import * as json from '../src/json'; describe('json', () => { @@ -53,28 +53,6 @@ describe('json', () => { }); }); - describe('cloneJson', () => { - it('clones a valid json map', () => { - const o = { a: 'a', b: ['b'] }; - const clone = json.cloneJson(o); - expect(clone).to.deep.equal(o); - expect(clone).to.not.equal(o); - }); - - it('clones a valid json array', () => { - const a = [{ a: 'a', b: ['b'] }, ['c', 1, true]]; - const clone = json.cloneJson(a); - expect(clone).to.deep.equal(a); - expect(clone).to.not.equal(a); - }); - - it('fails to clone an object with circular references', () => { - const o: Dictionary = {}; - o.o = o; - expect(() => json.cloneJson(o)).to.throw(JsonStringifyError); - }); - }); - describe('getJsonValuesByName', () => { it('returns a flattened array of all elements of a given name found in a JSON tree', () => { const data: JsonMap = { diff --git a/test/nodash/external.test.ts b/test/nodash/external.test.ts deleted file mode 100644 index 28cc6e83..00000000 --- a/test/nodash/external.test.ts +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import * as _ from '../../src/nodash'; - -describe('nodash', () => { - describe('defaults', () => { - it('should assign defaults', () => { - const result = _.defaults({ a: 1 }, { b: 2 }, { a: 3 }); - expect(result).to.deep.equal({ a: 1, b: 2 }); - }); - }); - - describe('findKey', () => { - it('should find keys in various ways', () => { - const users = { - barney: { age: 36, active: true }, - fred: { age: 40, active: false }, - pebbles: { age: 1, active: true }, - }; - - let result = _.findKey(users, (o) => o.age < 40); - expect(result).to.equal('barney'); - - result = _.findKey(users, { age: 1, active: true }); - expect(result).to.equal('pebbles'); - - result = _.findKey(users, ['active', false]); - expect(result).to.equal('fred'); - - result = _.findKey(users, 'active'); - expect(result).to.equal('barney'); - }); - }); - - describe('includes', () => { - it('should ', () => { - expect(_.includes([1, 2, 3], 1)).to.be.true; - expect(_.includes([1, 2, 3], 1, 2)).to.be.false; - expect(_.includes({ a: 1, b: 2 }, 1)).to.be.true; - expect(_.includes('abcd', 'bc')).to.be.true; - }); - }); - - describe('keyBy', () => { - it('should generate an object from keys of an array of objects', () => { - const array = [ - { dir: 'left', code: 97 }, - { dir: 'right', code: 100 }, - ]; - const result = _.keyBy(array, (o) => String.fromCharCode(o.code)); - expect(result).to.deep.equal({ - a: { dir: 'left', code: 97 }, - d: { dir: 'right', code: 100 }, - }); - }); - }); - - describe('mapKeys', () => { - it('should map the keys of an object', () => { - const obj = { a: 1, b: 2 }; - const result = _.mapKeys(obj, (value, key) => `${key}${value}`); - expect(result).to.deep.equal({ a1: 1, b2: 2 }); - }); - }); - - describe('minBy', () => { - it('should find objects by min values in various ways', () => { - const objects = [{ n: 1 }, { n: 2 }]; - - let result = _.minBy(objects, (o) => o.n); - expect(result).to.deep.equal({ n: 1 }); - - result = _.minBy(objects, 'n'); - expect(result).to.deep.equal({ n: 1 }); - }); - }); - - describe('maxBy', () => { - it('should find objects by max values in various ways', () => { - const objects = [{ n: 1 }, { n: 2 }]; - - let result = _.maxBy(objects, (o) => o.n); - expect(result).to.deep.equal({ n: 2 }); - - result = _.maxBy(objects, 'n'); - expect(result).to.deep.equal({ n: 2 }); - }); - }); - - describe('merge', () => { - it('should recursively merge objects', () => { - const users = { - data: [{ user: 'barney' }, { user: 'fred' }], - }; - - const ages = { - data: [{ age: 36 }, { age: 40 }], - }; - - const result = _.merge(users, ages); - expect(result).to.deep.equal({ - data: [ - { user: 'barney', age: 36 }, - { user: 'fred', age: 40 }, - ], - }); - }); - }); - - describe('omit', () => { - it('should omit properties of an object', () => { - const object = { a: 1, b: 2, c: 3 }; - - const result = _.omit(object, ['a', 'c']); - expect(result).to.deep.equal({ b: 2 }); - }); - }); - - describe('once', () => { - it('should ', () => { - const doInit = sinon.spy(); - const initialize = _.once(doInit); - initialize(); - initialize(); - expect(doInit.calledOnce).to.be.true; - }); - }); - - describe('set', () => { - it('should set values on an object in various ways', () => { - const obj = { a: [{ b: { c: 3 } }] }; - - const result1 = _.set(obj, 'a[0].b.c', 4); - expect(result1).to.deep.equal({ a: [{ b: { c: 4 } }] }); - - type NewType = typeof obj & { x: [{ y: { z: number } }] }; - const result2 = _.set(obj, 'x[0].y.z', 5); - expect(result2).to.deep.equal({ - a: [{ b: { c: 4 } }], - x: [{ y: { z: 5 } }], - }); - }); - }); - - describe('sortBy', () => { - it('should sort an objects keys and values in various ways', () => { - const users = [ - { user: 'fred', age: 48 }, - { user: 'barney', age: 36 }, - { user: 'fred', age: 42 }, - { user: 'barney', age: 34 }, - ]; - - let result = _.sortBy(users, (o) => o.user); - expect(result).to.deep.equal([ - { user: 'barney', age: 36 }, - { user: 'barney', age: 34 }, - { user: 'fred', age: 48 }, - { user: 'fred', age: 42 }, - ]); - - result = _.sortBy(users, ['user', 'age']); - expect(result).to.deep.equal([ - { user: 'barney', age: 34 }, - { user: 'barney', age: 36 }, - { user: 'fred', age: 42 }, - { user: 'fred', age: 48 }, - ]); - - result = _.sortBy(users, 'user', (o) => Math.floor(o.age / 10)); - expect(result).to.deep.equal([ - { user: 'barney', age: 36 }, - { user: 'barney', age: 34 }, - { user: 'fred', age: 48 }, - { user: 'fred', age: 42 }, - ]); - }); - }); - - describe('toNumber', () => { - it('should handle numbers', () => { - expect(_.toNumber(3)).to.equal(3); - }); - - it('should handle number constants', () => { - expect(_.toNumber(Number.MIN_VALUE)).to.equal(Number.MIN_VALUE); - }); - - it('should parse infinity', () => { - expect(_.toNumber('Infinity')).to.equal(Infinity); - }); - - it('should parse integers', () => { - expect(_.toNumber('3')).to.equal(3); - }); - - it('should parse floats', () => { - expect(_.toNumber('3.2')).to.equal(3.2); - }); - }); -}); diff --git a/test/nodash/internal.test.ts b/test/nodash/internal.test.ts deleted file mode 100644 index aad91cc7..00000000 --- a/test/nodash/internal.test.ts +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as _ from '../../src/nodash'; - -describe('nodash internal', () => { - describe('isEmpty', () => { - it('should return true given undefined', () => { - expect(_.isEmpty(undefined)).to.be.true; - }); - - it('should return true given null', () => { - expect(_.isEmpty(null)).to.be.true; - }); - - it('should return false given a number', () => { - expect(_.isEmpty(0)).to.be.false; - }); - - it('should return false given a boolean', () => { - expect(_.isEmpty(false)).to.be.false; - }); - - it('should return true given an empty array', () => { - expect(_.isEmpty([])).to.be.true; - }); - - it('should return false given an non-empty array', () => { - expect(_.isEmpty([0])).to.be.false; - }); - - it('should return true given an empty object', () => { - expect(_.isEmpty({})).to.be.true; - }); - - it('should return false given an non-empty object', () => { - expect(_.isEmpty({ a: 0 })).to.be.false; - }); - - it('should return true given an empty Map', () => { - expect(_.isEmpty(new Map())).to.be.true; - }); - - it('should return false given an non-empty Map', () => { - expect(_.isEmpty(new Map([['a', 1]]))).to.be.false; - }); - }); - - describe('lowerFirst', () => { - it('should return undefined if passed undefined', () => { - expect(_.lowerFirst()).to.be.undefined; - }); - - it('should return the empty string if passed the empty string', () => { - expect(_.lowerFirst('')).to.equal(''); - }); - - it('should return a string with a lower first letter if passed a string with length 1 or more', () => { - expect(_.lowerFirst('ABC')).to.equal('aBC'); - }); - }); - - describe('snakeCase', () => { - it('should snake case a variety of strings', () => { - let result = _.snakeCase('Foo Bar'); - expect(result).to.equal('foo_bar'); - - result = _.snakeCase('fooBar'); - expect(result).to.equal('foo_bar'); - - result = _.snakeCase('--FOO-BAR--'); - expect(result).to.equal('foo_bar'); - }); - }); - - describe('upperFirst', () => { - it('should return undefined if passed undefined', () => { - expect(_.upperFirst()).to.be.undefined; - }); - - it('should return the empty string if passed the empty string', () => { - expect(_.upperFirst('')).to.equal(''); - }); - - it('should return a string with an upper first letter if passed a string with length 1 or more', () => { - expect(_.upperFirst('abc')).to.equal('Abc'); - }); - }); - - describe('format', () => { - it('returns a title case string given a camel case one', () => { - let result = _.camelCaseToTitleCase('FooBar'); - expect(result).to.equal('Foo Bar'); - - result = _.camelCaseToTitleCase('fooBar'); - expect(result).to.equal('Foo Bar'); - - result = _.camelCaseToTitleCase('Foo Bar'); - expect(result).to.equal('Foo Bar'); - }); - }); - - describe('toBoolean', () => { - it('should return true given a string set to 1', () => { - expect(_.toBoolean('1')).to.equal(true); - }); - - it('should return false given any string that is not 1 or a boolean value', () => { - expect(_.toBoolean('0')).to.equal(false); - expect(_.toBoolean('sfdx')).to.equal(false); - }); - }); -}); diff --git a/vendor/lodash.js b/vendor/lodash.js deleted file mode 100644 index 8da41c8b..00000000 --- a/vendor/lodash.js +++ /dev/null @@ -1,1441 +0,0 @@ -/** - * @license - * Lodash (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE - * Build: `lodash exports="node" include="defaults,findKey,keyBy,includes,mapKeys,minBy,maxBy,merge,omit,once,set,sortBy,toNumber" -o vendor/lodash.js` - */ -(function () { - function t(t, e, n) { - switch (n.length) { - case 0: - return t.call(e); - case 1: - return t.call(e, n[0]); - case 2: - return t.call(e, n[0], n[1]); - case 3: - return t.call(e, n[0], n[1], n[2]); - } - return t.apply(e, n); - } - function e(t, e, n, r) { - for (var o = -1, u = null == t ? 0 : t.length; ++o < u; ) { - var c = t[o]; - e(r, c, n(c), t); - } - return r; - } - function n(t, e) { - for (var n = -1, r = null == t ? 0 : t.length; ++n < r && false !== e(t[n], n, t); ); - } - function r(t, e) { - for (var n = -1, r = null == t ? 0 : t.length, o = 0, u = []; ++n < r; ) { - var c = t[n]; - e(c, n, t) && (u[o++] = c); - } - return u; - } - function o(t, e) { - for (var n = -1, r = null == t ? 0 : t.length, o = Array(r); ++n < r; ) o[n] = e(t[n], n, t); - return o; - } - function u(t, e) { - for (var n = -1, r = e.length, o = t.length; ++n < r; ) t[o + n] = e[n]; - return t; - } - function c(t, e) { - for (var n = -1, r = null == t ? 0 : t.length; ++n < r; ) if (e(t[n], n, t)) return true; - return false; - } - function i(t, e, n) { - var r; - return ( - n(t, function (t, n, o) { - if (e(t, n, o)) return (r = n), false; - }), - r - ); - } - function a(t) { - return function (e) { - return null == e ? ue : e[t]; - }; - } - function f(t, e) { - var n = t.length; - for (t.sort(e); n--; ) t[n] = t[n].c; - return t; - } - function l(t) { - return function (e) { - return t(e); - }; - } - function s(t, e) { - return o(e, function (e) { - return t[e]; - }); - } - function b(t) { - var e = -1, - n = Array(t.size); - return ( - t.forEach(function (t, r) { - n[++e] = [r, t]; - }), - n - ); - } - function h(t) { - var e = Object; - return function (n) { - return t(e(n)); - }; - } - function p(t) { - var e = -1, - n = Array(t.size); - return ( - t.forEach(function (t) { - n[++e] = t; - }), - n - ); - } - function y() {} - function j(t) { - var e = -1, - n = null == t ? 0 : t.length; - for (this.clear(); ++e < n; ) { - var r = t[e]; - this.set(r[0], r[1]); - } - } - function v(t) { - var e = -1, - n = null == t ? 0 : t.length; - for (this.clear(); ++e < n; ) { - var r = t[e]; - this.set(r[0], r[1]); - } - } - function _(t) { - var e = -1, - n = null == t ? 0 : t.length; - for (this.clear(); ++e < n; ) { - var r = t[e]; - this.set(r[0], r[1]); - } - } - function g(t) { - var e = -1, - n = null == t ? 0 : t.length; - for (this.__data__ = new _(); ++e < n; ) this.add(t[e]); - } - function d(t) { - this.size = (this.__data__ = new v(t)).size; - } - function A(t, e) { - var n = In(t), - r = !n && Fn(t), - o = !n && !r && Bn(t), - u = !n && !r && !o && Un(t); - if ((n = n || r || o || u)) { - for (var r = t.length, c = String, i = -1, a = Array(r); ++i < r; ) a[i] = c(i); - r = a; - } else r = []; - var f, - c = r.length; - for (f in t) - (!e && !Pe.call(t, f)) || - (n && - ('length' == f || - (o && ('offset' == f || 'parent' == f)) || - (u && ('buffer' == f || 'byteLength' == f || 'byteOffset' == f)) || - At(f, c))) || - r.push(f); - return r; - } - function w(t, e, n) { - ((n === ue || Mt(t[e], n)) && (n !== ue || e in t)) || x(t, e, n); - } - function m(t, e, n) { - var r = t[e]; - (Pe.call(t, e) && Mt(r, n) && (n !== ue || e in t)) || x(t, e, n); - } - function O(t, e) { - for (var n = t.length; n--; ) if (Mt(t[n][0], e)) return n; - return -1; - } - function S(t, e, n, r) { - return ( - dn(t, function (t, o, u) { - e(r, t, n(t), u); - }), - r - ); - } - function k(t, e) { - return t && ut(e, Qt(e), t); - } - function z(t, e) { - return t && ut(e, Xt(e), t); - } - function x(t, e, n) { - '__proto__' == e && Ye ? Ye(t, e, { configurable: true, enumerable: true, value: n, writable: true }) : (t[e] = n); - } - function E(t, e, r, o, u, c) { - var i, - a = 1 & e, - f = 2 & e, - l = 4 & e; - if ((r && (i = u ? r(t, o, u, c) : r(t)), i !== ue)) return i; - if (!Lt(t)) return t; - if ((o = In(t))) { - if (((i = vt(t)), !a)) return ot(t, i); - } else { - var s = Sn(t), - b = '[object Function]' == s || '[object GeneratorFunction]' == s; - if (Bn(t)) return et(t, a); - if ('[object Object]' == s || '[object Arguments]' == s || (b && !u)) { - if (((i = f || b ? {} : _t(t)), !a)) return f ? it(t, z(i, t)) : ct(t, k(i, t)); - } else { - if (!de[s]) return u ? t : {}; - i = gt(t, s, a); - } - } - if ((c || (c = new d()), (u = c.get(t)))) return u; - if ((c.set(t, i), $n(t))) - return ( - t.forEach(function (n) { - i.add(E(n, e, r, n, t, c)); - }), - i - ); - if (Mn(t)) - return ( - t.forEach(function (n, o) { - i.set(o, E(n, e, r, o, t, c)); - }), - i - ); - var f = l ? (f ? bt : st) : f ? Xt : Qt, - h = o ? ue : f(t); - return ( - n(h || t, function (n, o) { - h && ((o = n), (n = t[o])), m(i, o, E(n, e, r, o, t, c)); - }), - i - ); - } - function F(t, e, n) { - for (var r = -1, o = t.length; ++r < o; ) { - var u = t[r], - c = e(u); - if (null != c && (i === ue ? c === c && !Vt(c) : n(c, i))) - var i = c, - a = u; - } - return a; - } - function I(t, e, n, r, o) { - var c = -1, - i = t.length; - for (n || (n = dt), o || (o = []); ++c < i; ) { - var a = t[c]; - 0 < e && n(a) ? (1 < e ? I(a, e - 1, n, r, o) : u(o, a)) : r || (o[o.length] = a); - } - return o; - } - function B(t, e) { - return t && An(t, e, Qt); - } - function M(t, e) { - e = tt(e, t); - for (var n = 0, r = e.length; null != t && n < r; ) t = t[zt(e[n++])]; - return n && n == r ? t : ue; - } - function $(t, e, n) { - return (e = e(t)), In(t) ? e : u(e, n(t)); - } - function U(t) { - if (null == t) t = t === ue ? '[object Undefined]' : '[object Null]'; - else if (Xe && Xe in Object(t)) { - var e = Pe.call(t, Xe), - n = t[Xe]; - try { - t[Xe] = ue; - var r = true; - } catch (t) {} - var o = Ne.call(t); - r && (e ? (t[Xe] = n) : delete t[Xe]), (t = o); - } else t = Ne.call(t); - return t; - } - function D(t, e) { - return t > e; - } - function P(t) { - return Nt(t) && '[object Arguments]' == U(t); - } - function L(t, e, n, r, o) { - if (t === e) e = true; - else if (null == t || null == e || (!Nt(t) && !Nt(e))) e = t !== t && e !== e; - else - t: { - var u = In(t), - c = In(e), - i = u ? '[object Array]' : Sn(t), - a = c ? '[object Array]' : Sn(e), - i = '[object Arguments]' == i ? '[object Object]' : i, - a = '[object Arguments]' == a ? '[object Object]' : a, - f = '[object Object]' == i, - c = '[object Object]' == a; - if ((a = i == a) && Bn(t)) { - if (!Bn(e)) { - e = false; - break t; - } - (u = true), (f = false); - } - if (a && !f) o || (o = new d()), (e = u || Un(t) ? ft(t, e, n, r, L, o) : lt(t, e, i, n, r, L, o)); - else { - if (!(1 & n) && ((u = f && Pe.call(t, '__wrapped__')), (i = c && Pe.call(e, '__wrapped__')), u || i)) { - (t = u ? t.value() : t), (e = i ? e.value() : e), o || (o = new d()), (e = L(t, e, n, r, o)); - break t; - } - if (a) - e: if ((o || (o = new d()), (u = 1 & n), (i = st(t)), (c = i.length), (a = st(e).length), c == a || u)) { - for (f = c; f--; ) { - var l = i[f]; - if (!(u ? l in e : Pe.call(e, l))) { - e = false; - break e; - } - } - if ((a = o.get(t)) && o.get(e)) e = a == e; - else { - (a = true), o.set(t, e), o.set(e, t); - for (var s = u; ++f < c; ) { - var l = i[f], - b = t[l], - h = e[l]; - if (r) var p = u ? r(h, b, l, e, t, o) : r(b, h, l, t, e, o); - if (p === ue ? b !== h && !L(b, h, n, r, o) : !p) { - a = false; - break; - } - s || (s = 'constructor' == l); - } - a && - !s && - ((n = t.constructor), - (r = e.constructor), - n != r && - 'constructor' in t && - 'constructor' in e && - !(typeof n == 'function' && n instanceof n && typeof r == 'function' && r instanceof r) && - (a = false)), - o.delete(t), - o.delete(e), - (e = a); - } - } else e = false; - else e = false; - } - } - return e; - } - function N(t) { - return Nt(t) && '[object Map]' == Sn(t); - } - function C(t, e) { - var n = e.length, - r = n; - if (null == t) return !r; - for (t = Object(t); n--; ) { - var o = e[n]; - if (o[2] ? o[1] !== t[o[0]] : !(o[0] in t)) return false; - } - for (; ++n < r; ) { - var o = e[n], - u = o[0], - c = t[u], - i = o[1]; - if (o[2]) { - if (c === ue && !(u in t)) return false; - } else if (((o = new d()), void 0 === ue ? !L(i, c, 3, void 0, o) : 1)) return false; - } - return true; - } - function T(t) { - return Nt(t) && '[object Set]' == Sn(t); - } - function V(t) { - return Nt(t) && Pt(t.length) && !!ge[U(t)]; - } - function R(t) { - return typeof t == 'function' ? t : null == t ? te : typeof t == 'object' ? (In(t) ? q(t[0], t[1]) : K(t)) : ne(t); - } - function W(t, e) { - return t < e; - } - function G(t, e) { - var n = -1, - r = $t(t) ? Array(t.length) : []; - return ( - dn(t, function (t, o, u) { - r[++n] = e(t, o, u); - }), - r - ); - } - function K(t) { - var e = yt(t); - return 1 == e.length && e[0][2] - ? St(e[0][0], e[0][1]) - : function (n) { - return n === t || C(n, e); - }; - } - function q(t, e) { - return mt(t) && e === e && !Lt(e) - ? St(zt(t), e) - : function (n) { - var r = Ht(n, t); - return r === ue && r === e ? Jt(n, t) : L(e, r, 3); - }; - } - function H(t, e, n, r, o) { - t !== e && - An( - e, - function (u, c) { - if (Lt(u)) { - o || (o = new d()); - var i = o, - a = '__proto__' == c ? ue : t[c], - f = '__proto__' == c ? ue : e[c], - l = i.get(f); - if (l) w(t, c, l); - else { - var l = r ? r(a, f, c + '', t, e, i) : ue, - s = l === ue; - if (s) { - var b = In(f), - h = !b && Bn(f), - p = !b && !h && Un(f), - l = f; - b || h || p - ? In(a) - ? (l = a) - : Ut(a) - ? (l = ot(a)) - : h - ? ((s = false), (l = et(f, true))) - : p - ? ((s = false), (l = rt(f, true))) - : (l = []) - : Ct(f) || Fn(f) - ? ((l = a), Fn(a) ? (l = Kt(a)) : (!Lt(a) || (n && Dt(a))) && (l = _t(f))) - : (s = false); - } - s && (i.set(f, l), H(l, f, n, r, i), i.delete(f)), w(t, c, l); - } - } else (i = r ? r('__proto__' == c ? ue : t[c], u, c + '', t, e, o) : ue), i === ue && (i = u), w(t, c, i); - }, - Xt - ); - } - function J(t, e) { - var n = [], - r = -1; - return ( - (e = o(e.length ? e : [te], l(ht()))), - f( - G(t, function (t) { - return { - a: o(e, function (e) { - return e(t); - }), - b: ++r, - c: t, - }; - }), - function (t, e) { - var r; - t: { - r = -1; - for (var o = t.a, u = e.a, c = o.length, i = n.length; ++r < c; ) { - var a; - e: { - a = o[r]; - var f = u[r]; - if (a !== f) { - var l = a !== ue, - s = null === a, - b = a === a, - h = Vt(a), - p = f !== ue, - y = null === f, - j = f === f, - v = Vt(f); - if ((!y && !v && !h && a > f) || (h && p && j && !y && !v) || (s && p && j) || (!l && j) || !b) { - a = 1; - break e; - } - if ((!s && !h && !v && a < f) || (v && l && b && !s && !h) || (y && l && b) || (!p && b) || !j) { - a = -1; - break e; - } - } - a = 0; - } - if (a) { - r = r >= i ? a : a * ('desc' == n[r] ? -1 : 1); - break t; - } - } - r = t.b - e.b; - } - return r; - } - ) - ); - } - function Q(t) { - return function (e) { - return M(e, t); - }; - } - function X(t) { - return kn(kt(t, void 0, te), t + ''); - } - function Y(t) { - if (typeof t == 'string') return t; - if (In(t)) return o(t, Y) + ''; - if (Vt(t)) return _n ? _n.call(t) : ''; - var e = t + ''; - return '0' == e && 1 / t == -ce ? '-0' : e; - } - function Z(t, e) { - e = tt(e, t); - var n; - if (2 > e.length) n = t; - else { - n = e; - var r = 0, - o = -1, - u = -1, - c = n.length; - for ( - 0 > r && (r = -r > c ? 0 : c + r), - o = o > c ? c : o, - 0 > o && (o += c), - c = r > o ? 0 : (o - r) >>> 0, - r >>>= 0, - o = Array(c); - ++u < c; - - ) - o[u] = n[u + r]; - n = M(t, o); - } - (t = n), null == t || delete t[zt(Ft(e))]; - } - function tt(t, e) { - return In(t) ? t : mt(t, e) ? [t] : zn(qt(t)); - } - function et(t, e) { - if (e) return t.slice(); - var n = t.length, - n = Ge ? Ge(n) : new t.constructor(n); - return t.copy(n), n; - } - function nt(t) { - var e = new t.constructor(t.byteLength); - return new We(e).set(new We(t)), e; - } - function rt(t, e) { - return new t.constructor(e ? nt(t.buffer) : t.buffer, t.byteOffset, t.length); - } - function ot(t, e) { - var n = -1, - r = t.length; - for (e || (e = Array(r)); ++n < r; ) e[n] = t[n]; - return e; - } - function ut(t, e, n) { - var r = !n; - n || (n = {}); - for (var o = -1, u = e.length; ++o < u; ) { - var c = e[o], - i = ue; - i === ue && (i = t[c]), r ? x(n, c, i) : m(n, c, i); - } - return n; - } - function ct(t, e) { - return ut(t, mn(t), e); - } - function it(t, e) { - return ut(t, On(t), e); - } - function at(t) { - return Ct(t) ? ue : t; - } - function ft(t, e, n, r, o, u) { - var i = 1 & n, - a = t.length, - f = e.length; - if (a != f && !(i && f > a)) return false; - if ((f = u.get(t)) && u.get(e)) return f == e; - var f = -1, - l = true, - s = 2 & n ? new g() : ue; - for (u.set(t, e), u.set(e, t); ++f < a; ) { - var b = t[f], - h = e[f]; - if (r) var p = i ? r(h, b, f, e, t, u) : r(b, h, f, t, e, u); - if (p !== ue) { - if (p) continue; - l = false; - break; - } - if (s) { - if ( - !c(e, function (t, e) { - if (!s.has(e) && (b === t || o(b, t, n, r, u))) return s.push(e); - }) - ) { - l = false; - break; - } - } else if (b !== h && !o(b, h, n, r, u)) { - l = false; - break; - } - } - return u.delete(t), u.delete(e), l; - } - function lt(t, e, n, r, o, u, c) { - switch (n) { - case '[object DataView]': - if (t.byteLength != e.byteLength || t.byteOffset != e.byteOffset) break; - (t = t.buffer), (e = e.buffer); - case '[object ArrayBuffer]': - if (t.byteLength != e.byteLength || !u(new We(t), new We(e))) break; - return true; - case '[object Boolean]': - case '[object Date]': - case '[object Number]': - return Mt(+t, +e); - case '[object Error]': - return t.name == e.name && t.message == e.message; - case '[object RegExp]': - case '[object String]': - return t == e + ''; - case '[object Map]': - var i = b; - case '[object Set]': - if ((i || (i = p), t.size != e.size && !(1 & r))) break; - return (n = c.get(t)) ? n == e : ((r |= 2), c.set(t, e), (e = ft(i(t), i(e), r, o, u, c)), c.delete(t), e); - case '[object Symbol]': - if (vn) return vn.call(t) == vn.call(e); - } - return false; - } - function st(t) { - return $(t, Qt, mn); - } - function bt(t) { - return $(t, Xt, On); - } - function ht() { - var t = y.iteratee || ee, - t = t === ee ? R : t; - return arguments.length ? t(arguments[0], arguments[1]) : t; - } - function pt(t, e) { - var n = t.__data__, - r = typeof e; - return ('string' == r || 'number' == r || 'symbol' == r || 'boolean' == r ? '__proto__' !== e : null === e) - ? n[typeof e == 'string' ? 'string' : 'hash'] - : n.map; - } - function yt(t) { - for (var e = Qt(t), n = e.length; n--; ) { - var r = e[n], - o = t[r]; - e[n] = [r, o, o === o && !Lt(o)]; - } - return e; - } - function jt(t, e) { - var n = null == t ? ue : t[e]; - return (!Lt(n) || (Le && Le in n) ? 0 : (Dt(n) ? Te : je).test(xt(n))) ? n : ue; - } - function vt(t) { - var e = t.length, - n = new t.constructor(e); - return e && 'string' == typeof t[0] && Pe.call(t, 'index') && ((n.index = t.index), (n.input = t.input)), n; - } - function _t(t) { - return typeof t.constructor != 'function' || Ot(t) ? {} : gn(Ke(t)); - } - function gt(t, e, n) { - var r = t.constructor; - switch (e) { - case '[object ArrayBuffer]': - return nt(t); - case '[object Boolean]': - case '[object Date]': - return new r(+t); - case '[object DataView]': - return (e = n ? nt(t.buffer) : t.buffer), new t.constructor(e, t.byteOffset, t.byteLength); - case '[object Float32Array]': - case '[object Float64Array]': - case '[object Int8Array]': - case '[object Int16Array]': - case '[object Int32Array]': - case '[object Uint8Array]': - case '[object Uint8ClampedArray]': - case '[object Uint16Array]': - case '[object Uint32Array]': - return rt(t, n); - case '[object Map]': - return new r(); - case '[object Number]': - case '[object String]': - return new r(t); - case '[object RegExp]': - return (e = new t.constructor(t.source, he.exec(t))), (e.lastIndex = t.lastIndex), e; - case '[object Set]': - return new r(); - case '[object Symbol]': - return vn ? Object(vn.call(t)) : {}; - } - } - function dt(t) { - return In(t) || Fn(t) || !!(Qe && t && t[Qe]); - } - function At(t, e) { - var n = typeof t; - return ( - (e = null == e ? 9007199254740991 : e), - !!e && ('number' == n || ('symbol' != n && _e.test(t))) && -1 < t && 0 == t % 1 && t < e - ); - } - function wt(t, e, n) { - if (!Lt(n)) return false; - var r = typeof e; - return !!('number' == r ? $t(n) && At(e, n.length) : 'string' == r && e in n) && Mt(n[e], t); - } - function mt(t, e) { - if (In(t)) return false; - var n = typeof t; - return ( - !('number' != n && 'symbol' != n && 'boolean' != n && null != t && !Vt(t)) || - fe.test(t) || - !ae.test(t) || - (null != e && t in Object(e)) - ); - } - function Ot(t) { - var e = t && t.constructor; - return t === ((typeof e == 'function' && e.prototype) || $e); - } - function St(t, e) { - return function (n) { - return null != n && n[t] === e && (e !== ue || t in Object(n)); - }; - } - function kt(e, n, r) { - return ( - (n = nn(n === ue ? e.length - 1 : n, 0)), - function () { - for (var o = arguments, u = -1, c = nn(o.length - n, 0), i = Array(c); ++u < c; ) i[u] = o[n + u]; - for (u = -1, c = Array(n + 1); ++u < n; ) c[u] = o[u]; - return (c[n] = r(i)), t(e, this, c); - } - ); - } - function zt(t) { - if (typeof t == 'string' || Vt(t)) return t; - var e = t + ''; - return '0' == e && 1 / t == -ce ? '-0' : e; - } - function xt(t) { - if (null != t) { - try { - return De.call(t); - } catch (t) {} - return t + ''; - } - return ''; - } - function Et(t) { - return (null == t ? 0 : t.length) ? I(t, 1) : []; - } - function Ft(t) { - var e = null == t ? 0 : t.length; - return e ? t[e - 1] : ue; - } - function It(t, e) { - var n; - if (typeof e != 'function') throw new TypeError('Expected a function'); - return ( - (t = Wt(t)), - function () { - return 0 < --t && (n = e.apply(this, arguments)), 1 >= t && (e = ue), n; - } - ); - } - function Bt(t, e) { - function n() { - var r = arguments, - o = e ? e.apply(this, r) : r[0], - u = n.cache; - return u.has(o) ? u.get(o) : ((r = t.apply(this, r)), (n.cache = u.set(o, r) || u), r); - } - if (typeof t != 'function' || (null != e && typeof e != 'function')) throw new TypeError('Expected a function'); - return (n.cache = new (Bt.Cache || _)()), n; - } - function Mt(t, e) { - return t === e || (t !== t && e !== e); - } - function $t(t) { - return null != t && Pt(t.length) && !Dt(t); - } - function Ut(t) { - return Nt(t) && $t(t); - } - function Dt(t) { - return ( - !!Lt(t) && - ((t = U(t)), - '[object Function]' == t || - '[object GeneratorFunction]' == t || - '[object AsyncFunction]' == t || - '[object Proxy]' == t) - ); - } - function Pt(t) { - return typeof t == 'number' && -1 < t && 0 == t % 1 && 9007199254740991 >= t; - } - function Lt(t) { - var e = typeof t; - return null != t && ('object' == e || 'function' == e); - } - function Nt(t) { - return null != t && typeof t == 'object'; - } - function Ct(t) { - return ( - !(!Nt(t) || '[object Object]' != U(t)) && - ((t = Ke(t)), - null === t || - ((t = Pe.call(t, 'constructor') && t.constructor), - typeof t == 'function' && t instanceof t && De.call(t) == Ce)) - ); - } - function Tt(t) { - return typeof t == 'string' || (!In(t) && Nt(t) && '[object String]' == U(t)); - } - function Vt(t) { - return typeof t == 'symbol' || (Nt(t) && '[object Symbol]' == U(t)); - } - function Rt(t) { - return t - ? ((t = Gt(t)), t === ce || t === -ce ? 1.7976931348623157e308 * (0 > t ? -1 : 1) : t === t ? t : 0) - : 0 === t - ? t - : 0; - } - function Wt(t) { - t = Rt(t); - var e = t % 1; - return t === t ? (e ? t - e : t) : 0; - } - function Gt(t) { - if (typeof t == 'number') return t; - if (Vt(t)) return ie; - if ( - (Lt(t) && ((t = typeof t.valueOf == 'function' ? t.valueOf() : t), (t = Lt(t) ? t + '' : t)), - typeof t != 'string') - ) - return 0 === t ? t : +t; - t = t.replace(se, ''); - var e = ye.test(t); - return e || ve.test(t) ? we(t.slice(2), e ? 2 : 8) : pe.test(t) ? ie : +t; - } - function Kt(t) { - return ut(t, Xt(t)); - } - function qt(t) { - return null == t ? '' : Y(t); - } - function Ht(t, e, n) { - return (t = null == t ? ue : M(t, e)), t === ue ? n : t; - } - function Jt(t, e) { - var n; - if ((n = null != t)) { - n = t; - var r; - r = tt(e, n); - for (var o = -1, u = r.length, c = false; ++o < u; ) { - var i = zt(r[o]); - if (!(c = null != n && null != n && i in Object(n))) break; - n = n[i]; - } - c || ++o != u ? (n = c) : ((u = null == n ? 0 : n.length), (n = !!u && Pt(u) && At(i, u) && (In(n) || Fn(n)))); - } - return n; - } - function Qt(t) { - if ($t(t)) t = A(t); - else if (Ot(t)) { - var e, - n = []; - for (e in Object(t)) Pe.call(t, e) && 'constructor' != e && n.push(e); - t = n; - } else t = en(t); - return t; - } - function Xt(t) { - if ($t(t)) t = A(t, true); - else if (Lt(t)) { - var e, - n = Ot(t), - r = []; - for (e in t) ('constructor' != e || (!n && Pe.call(t, e))) && r.push(e); - t = r; - } else { - if (((e = []), null != t)) for (n in Object(t)) e.push(n); - t = e; - } - return t; - } - function Yt(t) { - return null == t ? [] : s(t, Qt(t)); - } - function Zt(t) { - return function () { - return t; - }; - } - function te(t) { - return t; - } - function ee(t) { - return R(typeof t == 'function' ? t : E(t, 1)); - } - function ne(t) { - return mt(t) ? a(zt(t)) : Q(t); - } - function re() { - return []; - } - function oe() { - return false; - } - var ue, - ce = 1 / 0, - ie = NaN, - ae = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - fe = /^\w*$/, - le = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, - se = /^\s+|\s+$/g, - be = /\\(\\)?/g, - he = /\w*$/, - pe = /^[-+]0x[0-9a-f]+$/i, - ye = /^0b[01]+$/i, - je = /^\[object .+?Constructor\]$/, - ve = /^0o[0-7]+$/i, - _e = /^(?:0|[1-9]\d*)$/, - ge = {}; - (ge['[object Float32Array]'] = - ge['[object Float64Array]'] = - ge['[object Int8Array]'] = - ge['[object Int16Array]'] = - ge['[object Int32Array]'] = - ge['[object Uint8Array]'] = - ge['[object Uint8ClampedArray]'] = - ge['[object Uint16Array]'] = - ge['[object Uint32Array]'] = - true), - (ge['[object Arguments]'] = - ge['[object Array]'] = - ge['[object ArrayBuffer]'] = - ge['[object Boolean]'] = - ge['[object DataView]'] = - ge['[object Date]'] = - ge['[object Error]'] = - ge['[object Function]'] = - ge['[object Map]'] = - ge['[object Number]'] = - ge['[object Object]'] = - ge['[object RegExp]'] = - ge['[object Set]'] = - ge['[object String]'] = - ge['[object WeakMap]'] = - false); - var de = {}; - (de['[object Arguments]'] = - de['[object Array]'] = - de['[object ArrayBuffer]'] = - de['[object DataView]'] = - de['[object Boolean]'] = - de['[object Date]'] = - de['[object Float32Array]'] = - de['[object Float64Array]'] = - de['[object Int8Array]'] = - de['[object Int16Array]'] = - de['[object Int32Array]'] = - de['[object Map]'] = - de['[object Number]'] = - de['[object Object]'] = - de['[object RegExp]'] = - de['[object Set]'] = - de['[object String]'] = - de['[object Symbol]'] = - de['[object Uint8Array]'] = - de['[object Uint8ClampedArray]'] = - de['[object Uint16Array]'] = - de['[object Uint32Array]'] = - true), - (de['[object Error]'] = de['[object Function]'] = de['[object WeakMap]'] = false); - var Ae, - we = parseInt, - me = typeof global == 'object' && global && global.Object === Object && global, - Oe = typeof self == 'object' && self && self.Object === Object && self, - Se = me || Oe || Function('return this')(), - ke = typeof exports == 'object' && exports && !exports.nodeType && exports, - ze = ke && typeof module == 'object' && module && !module.nodeType && module, - xe = ze && ze.exports === ke, - Ee = xe && me.process; - t: { - try { - Ae = Ee && Ee.binding && Ee.binding('util'); - break t; - } catch (t) {} - Ae = void 0; - } - var Fe = Ae && Ae.isMap, - Ie = Ae && Ae.isSet, - Be = Ae && Ae.isTypedArray, - Me = Array.prototype, - $e = Object.prototype, - Ue = Se['__core-js_shared__'], - De = Function.prototype.toString, - Pe = $e.hasOwnProperty, - Le = (function () { - var t = /[^.]+$/.exec((Ue && Ue.keys && Ue.keys.IE_PROTO) || ''); - return t ? 'Symbol(src)_1.' + t : ''; - })(), - Ne = $e.toString, - Ce = De.call(Object), - Te = RegExp( - '^' + - De.call(Pe) - .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + - '$' - ), - Ve = xe ? Se.Buffer : ue, - Re = Se.Symbol, - We = Se.Uint8Array, - Ge = Ve ? Ve.f : ue, - Ke = h(Object.getPrototypeOf), - qe = Object.create, - He = $e.propertyIsEnumerable, - Je = Me.splice, - Qe = Re ? Re.isConcatSpreadable : ue, - Xe = Re ? Re.toStringTag : ue, - Ye = (function () { - try { - var t = jt(Object, 'defineProperty'); - return t({}, '', {}), t; - } catch (t) {} - })(), - Ze = Object.getOwnPropertySymbols, - tn = Ve ? Ve.isBuffer : ue, - en = h(Object.keys), - nn = Math.max, - rn = Date.now, - on = jt(Se, 'DataView'), - un = jt(Se, 'Map'), - cn = jt(Se, 'Promise'), - an = jt(Se, 'Set'), - fn = jt(Se, 'WeakMap'), - ln = jt(Object, 'create'), - sn = xt(on), - bn = xt(un), - hn = xt(cn), - pn = xt(an), - yn = xt(fn), - jn = Re ? Re.prototype : ue, - vn = jn ? jn.valueOf : ue, - _n = jn ? jn.toString : ue, - gn = (function () { - function t() {} - return function (e) { - return Lt(e) ? (qe ? qe(e) : ((t.prototype = e), (e = new t()), (t.prototype = ue), e)) : {}; - }; - })(); - (j.prototype.clear = function () { - (this.__data__ = ln ? ln(null) : {}), (this.size = 0); - }), - (j.prototype.delete = function (t) { - return (t = this.has(t) && delete this.__data__[t]), (this.size -= t ? 1 : 0), t; - }), - (j.prototype.get = function (t) { - var e = this.__data__; - return ln ? ((t = e[t]), '__lodash_hash_undefined__' === t ? ue : t) : Pe.call(e, t) ? e[t] : ue; - }), - (j.prototype.has = function (t) { - var e = this.__data__; - return ln ? e[t] !== ue : Pe.call(e, t); - }), - (j.prototype.set = function (t, e) { - var n = this.__data__; - return (this.size += this.has(t) ? 0 : 1), (n[t] = ln && e === ue ? '__lodash_hash_undefined__' : e), this; - }), - (v.prototype.clear = function () { - (this.__data__ = []), (this.size = 0); - }), - (v.prototype.delete = function (t) { - var e = this.__data__; - return (t = O(e, t)), !(0 > t) && (t == e.length - 1 ? e.pop() : Je.call(e, t, 1), --this.size, true); - }), - (v.prototype.get = function (t) { - var e = this.__data__; - return (t = O(e, t)), 0 > t ? ue : e[t][1]; - }), - (v.prototype.has = function (t) { - return -1 < O(this.__data__, t); - }), - (v.prototype.set = function (t, e) { - var n = this.__data__, - r = O(n, t); - return 0 > r ? (++this.size, n.push([t, e])) : (n[r][1] = e), this; - }), - (_.prototype.clear = function () { - (this.size = 0), (this.__data__ = { hash: new j(), map: new (un || v)(), string: new j() }); - }), - (_.prototype.delete = function (t) { - return (t = pt(this, t).delete(t)), (this.size -= t ? 1 : 0), t; - }), - (_.prototype.get = function (t) { - return pt(this, t).get(t); - }), - (_.prototype.has = function (t) { - return pt(this, t).has(t); - }), - (_.prototype.set = function (t, e) { - var n = pt(this, t), - r = n.size; - return n.set(t, e), (this.size += n.size == r ? 0 : 1), this; - }), - (g.prototype.add = g.prototype.push = - function (t) { - return this.__data__.set(t, '__lodash_hash_undefined__'), this; - }), - (g.prototype.has = function (t) { - return this.__data__.has(t); - }), - (d.prototype.clear = function () { - (this.__data__ = new v()), (this.size = 0); - }), - (d.prototype.delete = function (t) { - var e = this.__data__; - return (t = e.delete(t)), (this.size = e.size), t; - }), - (d.prototype.get = function (t) { - return this.__data__.get(t); - }), - (d.prototype.has = function (t) { - return this.__data__.has(t); - }), - (d.prototype.set = function (t, e) { - var n = this.__data__; - if (n instanceof v) { - var r = n.__data__; - if (!un || 199 > r.length) return r.push([t, e]), (this.size = ++n.size), this; - n = this.__data__ = new _(r); - } - return n.set(t, e), (this.size = n.size), this; - }); - var dn = (function (t, e) { - return function (n, r) { - if (null == n) return n; - if (!$t(n)) return t(n, r); - for (var o = n.length, u = e ? o : -1, c = Object(n); (e ? u-- : ++u < o) && false !== r(c[u], u, c); ); - return n; - }; - })(B), - An = (function (t) { - return function (e, n, r) { - var o = -1, - u = Object(e); - r = r(e); - for (var c = r.length; c--; ) { - var i = r[t ? c : ++o]; - if (false === n(u[i], i, u)) break; - } - return e; - }; - })(), - wn = Ye - ? function (t, e) { - return Ye(t, 'toString', { configurable: true, enumerable: false, value: Zt(e), writable: true }); - } - : te, - mn = Ze - ? function (t) { - return null == t - ? [] - : ((t = Object(t)), - r(Ze(t), function (e) { - return He.call(t, e); - })); - } - : re, - On = Ze - ? function (t) { - for (var e = []; t; ) u(e, mn(t)), (t = Ke(t)); - return e; - } - : re, - Sn = U; - ((on && '[object DataView]' != Sn(new on(new ArrayBuffer(1)))) || - (un && '[object Map]' != Sn(new un())) || - (cn && '[object Promise]' != Sn(cn.resolve())) || - (an && '[object Set]' != Sn(new an())) || - (fn && '[object WeakMap]' != Sn(new fn()))) && - (Sn = function (t) { - var e = U(t); - if ((t = (t = '[object Object]' == e ? t.constructor : ue) ? xt(t) : '')) - switch (t) { - case sn: - return '[object DataView]'; - case bn: - return '[object Map]'; - case hn: - return '[object Promise]'; - case pn: - return '[object Set]'; - case yn: - return '[object WeakMap]'; - } - return e; - }); - var kn = (function (t) { - var e = 0, - n = 0; - return function () { - var r = rn(), - o = 16 - (r - n); - if (((n = r), 0 < o)) { - if (800 <= ++e) return arguments[0]; - } else e = 0; - return t.apply(ue, arguments); - }; - })(wn), - zn = (function (t) { - t = Bt(t, function (t) { - return 500 === e.size && e.clear(), t; - }); - var e = t.cache; - return t; - })(function (t) { - var e = []; - return ( - 46 === t.charCodeAt(0) && e.push(''), - t.replace(le, function (t, n, r, o) { - e.push(r ? o.replace(be, '$1') : n || t); - }), - e - ); - }), - xn = (function (t, n) { - return function (r, o) { - var u = In(r) ? e : S, - c = n ? n() : {}; - return u(r, t, ht(o, 2), c); - }; - })(function (t, e, n) { - x(t, n, e); - }), - En = X(function (t, e) { - if (null == t) return []; - var n = e.length; - return 1 < n && wt(t, e[0], e[1]) ? (e = []) : 2 < n && wt(e[0], e[1], e[2]) && (e = [e[0]]), J(t, I(e, 1)); - }); - Bt.Cache = _; - var Fn = P( - (function () { - return arguments; - })() - ) - ? P - : function (t) { - return Nt(t) && Pe.call(t, 'callee') && !He.call(t, 'callee'); - }, - In = Array.isArray, - Bn = tn || oe, - Mn = Fe ? l(Fe) : N, - $n = Ie ? l(Ie) : T, - Un = Be ? l(Be) : V, - Dn = X(function (t, e) { - t = Object(t); - var n = -1, - r = e.length, - o = 2 < r ? e[2] : ue; - for (o && wt(e[0], e[1], o) && (r = 1); ++n < r; ) - for (var o = e[n], u = Xt(o), c = -1, i = u.length; ++c < i; ) { - var a = u[c], - f = t[a]; - (f === ue || (Mt(f, $e[a]) && !Pe.call(t, a))) && (t[a] = o[a]); - } - return t; - }), - Pn = (function (t) { - return X(function (e, n) { - var r = -1, - o = n.length, - u = 1 < o ? n[o - 1] : ue, - c = 2 < o ? n[2] : ue, - u = 3 < t.length && typeof u == 'function' ? (o--, u) : ue; - for (c && wt(n[0], n[1], c) && ((u = 3 > o ? ue : u), (o = 1)), e = Object(e); ++r < o; ) - (c = n[r]) && t(e, c, r, u); - return e; - }); - })(function (t, e, n) { - H(t, e, n); - }), - Ln = (function (t) { - return kn(kt(t, ue, Et), t + ''); - })(function (t, e) { - var n = {}; - if (null == t) return n; - var r = false; - (e = o(e, function (e) { - return (e = tt(e, t)), r || (r = 1 < e.length), e; - })), - ut(t, bt(t), n), - r && (n = E(n, 7, at)); - for (var u = e.length; u--; ) Z(n, e[u]); - return n; - }); - (y.before = It), - (y.constant = Zt), - (y.defaults = Dn), - (y.flatten = Et), - (y.iteratee = ee), - (y.keyBy = xn), - (y.keys = Qt), - (y.keysIn = Xt), - (y.mapKeys = function (t, e) { - var n = {}; - return ( - (e = ht(e, 3)), - B(t, function (t, r, o) { - x(n, e(t, r, o), t); - }), - n - ); - }), - (y.memoize = Bt), - (y.merge = Pn), - (y.omit = Ln), - (y.once = function (t) { - return It(2, t); - }), - (y.property = ne), - (y.set = function (t, e, n) { - if (null != t && Lt(t)) { - e = tt(e, t); - for (var r = -1, o = e.length, u = o - 1, c = t; null != c && ++r < o; ) { - var i = zt(e[r]), - a = n; - if (r != u) { - var f = c[i], - a = ue; - a === ue && (a = Lt(f) ? f : At(e[r + 1]) ? [] : {}); - } - m(c, i, a), (c = c[i]); - } - } - return t; - }), - (y.sortBy = En), - (y.toPlainObject = Kt), - (y.values = Yt), - (y.eq = Mt), - (y.findKey = function (t, e) { - return i(t, ht(e, 3), B); - }), - (y.get = Ht), - (y.hasIn = Jt), - (y.identity = te), - (y.includes = function (t, e, n, r) { - if (((t = $t(t) ? t : Yt(t)), (n = n && !r ? Wt(n) : 0), (r = t.length), 0 > n && (n = nn(r + n, 0)), Tt(t))) - t = n <= r && -1 < t.indexOf(e, n); - else { - if ((r = !!r)) { - if (e === e) - t: { - for (n -= 1, r = t.length; ++n < r; ) - if (t[n] === e) { - t = n; - break t; - } - t = -1; - } - else - t: { - for (e = t.length, n += -1; ++n < e; ) - if (((r = t[n]), r !== r)) { - t = n; - break t; - } - t = -1; - } - r = -1 < t; - } - t = r; - } - return t; - }), - (y.isArguments = Fn), - (y.isArray = In), - (y.isArrayLike = $t), - (y.isArrayLikeObject = Ut), - (y.isBuffer = Bn), - (y.isFunction = Dt), - (y.isLength = Pt), - (y.isMap = Mn), - (y.isObject = Lt), - (y.isObjectLike = Nt), - (y.isPlainObject = Ct), - (y.isSet = $n), - (y.isString = Tt), - (y.isSymbol = Vt), - (y.isTypedArray = Un), - (y.last = Ft), - (y.maxBy = function (t, e) { - return t && t.length ? F(t, ht(e, 2), D) : ue; - }), - (y.minBy = function (t, e) { - return t && t.length ? F(t, ht(e, 2), W) : ue; - }), - (y.stubArray = re), - (y.stubFalse = oe), - (y.toFinite = Rt), - (y.toInteger = Wt), - (y.toNumber = Gt), - (y.toString = qt), - (y.VERSION = '4.17.5'), - ze && (((ze.exports = y)._ = y), (ke._ = y)); -}.call(this)); diff --git a/yarn.lock b/yarn.lock index f19c1e88..c4f28758 100644 --- a/yarn.lock +++ b/yarn.lock @@ -809,14 +809,6 @@ ajv@^8.11.0: require-from-string "^2.0.2" uri-js "^4.2.2" -align-text@^0.1.1, align-text@^0.1.3: - version "0.1.4" - resolved "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz" - dependencies: - kind-of "^3.0.2" - longest "^1.0.1" - repeat-string "^1.5.2" - ansi-colors@4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz" @@ -976,10 +968,6 @@ assertion-error@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz" -async@~0.2.6: - version "0.2.10" - resolved "https://registry.npmjs.org/async/-/async-0.2.10.tgz" - available-typed-arrays@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" @@ -1068,10 +1056,6 @@ camelcase-keys@^6.2.2: map-obj "^4.0.0" quick-lru "^4.0.1" -camelcase@^1.0.2: - version "1.2.1" - resolved "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz" - camelcase@^5.0.0, camelcase@^5.3.1: version "5.3.1" resolved "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz" @@ -1084,13 +1068,6 @@ caniuse-lite@^1.0.30001248: version "1.0.30001251" resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz" -center-align@^0.1.1: - version "0.1.3" - resolved "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz" - dependencies: - align-text "^0.1.3" - lazy-cache "^1.0.3" - chai@^4.3.10: version "4.3.10" resolved "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz#d784cec635e3b7e2ffb66446a63b4e33bd390384" @@ -1169,14 +1146,6 @@ clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz" -cliui@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz" - dependencies: - center-align "^0.1.1" - right-align "^0.1.1" - wordwrap "0.0.2" - cliui@^6.0.0: version "6.0.0" resolved "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz" @@ -1202,12 +1171,6 @@ cliui@^8.0.1: strip-ansi "^6.0.1" wrap-ansi "^7.0.0" -closure-compiler@0.2.12: - version "0.2.12" - resolved "https://registry.npmjs.org/closure-compiler/-/closure-compiler-0.2.12.tgz" - dependencies: - google-closure-compiler "20150901.x" - color-convert@^1.9.0: version "1.9.3" resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz" @@ -1346,7 +1309,7 @@ decamelize-keys@^1.1.0: decamelize "^1.1.0" map-obj "^1.0.0" -decamelize@^1.0.0, decamelize@^1.1.0, decamelize@^1.2.0: +decamelize@^1.1.0, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz" @@ -2029,17 +1992,6 @@ glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" -glob@7.1.1: - version "7.1.1" - resolved "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.2" - once "^1.3.0" - path-is-absolute "^1.0.0" - glob@7.2.0, glob@^7.0.0, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.2.0" resolved "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" @@ -2099,10 +2051,6 @@ globby@^11.1.0: merge2 "^1.4.1" slash "^3.0.0" -google-closure-compiler@20150901.x: - version "20150901.0.0" - resolved "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20150901.0.0.tgz" - gopd@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" @@ -2314,10 +2262,6 @@ is-boolean-object@^1.1.0: call-bind "^1.0.2" has-tostringtag "^1.0.0" -is-buffer@^1.1.5: - version "1.1.6" - resolved "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz" - is-builtin-module@^3.2.1: version "3.2.1" resolved "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz#f03271717d8654cfcaf07ab0463faa3571581169" @@ -2615,20 +2559,10 @@ just-extend@^4.0.2: version "4.2.1" resolved "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz" -kind-of@^3.0.2: - version "3.2.2" - resolved "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" - dependencies: - is-buffer "^1.1.5" - kind-of@^6.0.3: version "6.0.3" resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz" -lazy-cache@^1.0.3: - version "1.0.4" - resolved "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz" - levn@^0.4.1: version "0.4.1" resolved "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz" @@ -2668,16 +2602,6 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" -lodash-cli@^4.17.5: - version "4.17.5" - resolved "https://registry.npmjs.org/lodash-cli/-/lodash-cli-4.17.5.tgz" - dependencies: - closure-compiler "0.2.12" - glob "7.1.1" - lodash "4.17.5" - semver "5.3.0" - uglify-js "2.7.5" - lodash.camelcase@^4.3.0: version "4.3.0" resolved "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" @@ -2735,10 +2659,6 @@ lodash.upperfirst@^4.3.1: resolved "https://registry.npmjs.org/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce" integrity sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg== -lodash@4.17.5: - version "4.17.5" - resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz" - lodash@^4.17.15: version "4.17.21" resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" @@ -2751,10 +2671,6 @@ log-symbols@4.1.0: chalk "^4.1.0" is-unicode-supported "^0.1.0" -longest@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz" - loupe@^2.3.6: version "2.3.6" resolved "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz#76e4af498103c532d1ecc9be102036a21f787b53" @@ -2862,7 +2778,7 @@ minimatch@5.0.1: dependencies: brace-expansion "^2.0.1" -minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.2: +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -3364,10 +3280,6 @@ release-zalgo@^1.0.0: dependencies: es6-error "^4.0.1" -repeat-string@^1.5.2: - version "1.6.1" - resolved "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz" - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" @@ -3412,12 +3324,6 @@ reusify@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz" -right-align@^0.1.1: - version "0.1.3" - resolved "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz" - dependencies: - align-text "^0.1.1" - rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz" @@ -3461,10 +3367,6 @@ safe-regex-test@^1.0.0: version "5.7.1" resolved "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz" -semver@5.3.0: - version "5.3.0" - resolved "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz" - semver@7.3.8: version "7.3.8" resolved "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" @@ -3589,7 +3491,7 @@ source-map-support@^0.5.21: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.5.0, source-map@~0.5.1: +source-map@^0.5.0: version "0.5.7" resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz" @@ -3935,19 +3837,6 @@ typescript@^5.3.3: resolved "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37" integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw== -uglify-js@2.7.5: - version "2.7.5" - resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-2.7.5.tgz" - dependencies: - async "~0.2.6" - source-map "~0.5.1" - uglify-to-browserify "~1.0.0" - yargs "~3.10.0" - -uglify-to-browserify@~1.0.0: - version "1.0.2" - resolved "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz" - unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" @@ -4047,10 +3936,6 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -window-size@0.1.0: - version "0.1.0" - resolved "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz" - wireit@^0.14.1: version "0.14.1" resolved "https://registry.npmjs.org/wireit/-/wireit-0.14.1.tgz#83b63598503573db6722ad49b1fe15b57ee71890" @@ -4062,10 +3947,6 @@ wireit@^0.14.1: jsonc-parser "^3.0.0" proper-lockfile "^4.1.2" -wordwrap@0.0.2: - version "0.0.2" - resolved "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz" - workerpool@6.2.1: version "6.2.1" resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" @@ -4205,15 +4086,6 @@ yargs@^17.0.0: y18n "^5.0.5" yargs-parser "^21.1.1" -yargs@~3.10.0: - version "3.10.0" - resolved "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz" - dependencies: - camelcase "^1.0.2" - cliui "^2.1.0" - decamelize "^1.0.0" - window-size "0.1.0" - yn@3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz"