@applitools/utils
Advanced tools
Comparing version 1.3.16 to 1.3.17
@@ -102,3 +102,3 @@ "use strict"; | ||
var _a; | ||
const key = JSON.stringify((_a = getKey === null || getKey === void 0 ? void 0 : getKey(args)) !== null && _a !== void 0 ? _a : args, (_, t) => (typeof t === 'function' ? t.toString() : t)); | ||
const key = stringifyKey((_a = getKey === null || getKey === void 0 ? void 0 : getKey(args)) !== null && _a !== void 0 ? _a : args); | ||
let value = cache.get(key); | ||
@@ -113,3 +113,7 @@ if (!value) { | ||
funcWithCache.getCachedValues = () => Array.from(cache.values()); | ||
funcWithCache.setCachedValue = (key, value) => cache.set(stringifyKey(key), value); | ||
return funcWithCache; | ||
function stringifyKey(key) { | ||
return JSON.stringify(key, (_key, value) => (typeof value === 'function' ? value.toString() : value)); | ||
} | ||
} | ||
@@ -140,5 +144,6 @@ exports.cachify = cachify; | ||
function extend(target, extension) { | ||
return Object.defineProperties({}, { | ||
const result = {}; | ||
return Object.defineProperties(result, { | ||
...Object.getOwnPropertyDescriptors(target), | ||
...Object.getOwnPropertyDescriptors(extension), | ||
...Object.getOwnPropertyDescriptors(types.isFunction(extension) ? extension(result) : extension), | ||
}); | ||
@@ -145,0 +150,0 @@ } |
@@ -29,3 +29,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.config = exports.process = exports.math = exports.geometry = exports.general = exports.guard = exports.types = void 0; | ||
exports.config = exports.process = exports.math = exports.promises = exports.geometry = exports.general = exports.guard = exports.types = void 0; | ||
__exportStar(require("./utility-types"), exports); | ||
@@ -36,4 +36,5 @@ exports.types = __importStar(require("./types")); | ||
exports.geometry = __importStar(require("./geometry")); | ||
exports.promises = __importStar(require("./promises")); | ||
exports.math = __importStar(require("./math")); | ||
exports.process = __importStar(require("./process")); | ||
exports.config = __importStar(require("./config")); |
{ | ||
"name": "@applitools/utils", | ||
"version": "1.3.16", | ||
"version": "1.3.17", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "applitools", |
@@ -26,4 +26,5 @@ export declare function getEnvValue<T extends 'boolean' | 'number' | 'string' = 'string'>(name: string, type?: T): T extends 'boolean' ? boolean : T extends 'number' ? number : string; | ||
export declare function cachify<TFunc extends (...args: any[]) => any>(func: TFunc, getKey?: (args: Parameters<TFunc>) => any): TFunc & { | ||
getCachedValues(): ReturnType<TFunc>[]; | ||
setCachedValue(key: any, value: ReturnType<TFunc>): void; | ||
clearCache(): void; | ||
getCachedValues(): ReturnType<TFunc>[]; | ||
}; | ||
@@ -37,3 +38,3 @@ export declare function batchify<TFunc extends (batch: [TInput, { | ||
export declare function wrap<TFunc extends (...args: any[]) => any>(func: TFunc, wrapper: (func: TFunc, ...args: Parameters<TFunc>) => ReturnType<TFunc>): TFunc; | ||
export declare function extend<TTarget extends Record<PropertyKey, any>, TExtension extends Record<PropertyKey, any>>(target: TTarget, extension: TExtension): TTarget & TExtension; | ||
export declare function extend<TTarget extends Record<PropertyKey, any>, TExtension extends Record<PropertyKey, any>>(target: TTarget, extension: TExtension | ((result: any) => TExtension)): TTarget & TExtension; | ||
export declare function pluralize(object: [] | number, config?: [manyCase: string, singleCase: string]): string; |
@@ -6,4 +6,5 @@ export * from './utility-types'; | ||
export * as geometry from './geometry'; | ||
export * as promises from './promises'; | ||
export * as math from './math'; | ||
export * as process from './process'; | ||
export * as config from './config'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67816
24
1195