@applitools/utils
Advanced tools
+7
-0
| # Changelog | ||
| ## [1.9.0](https://github.com/Applitools-Dev/sdk/compare/js/utils@1.8.2...js/utils@1.9.0) (2025-07-07) | ||
| ### Features | ||
| * support https_proxy and http_proxy env variables | FLD-2702 ([#3046](https://github.com/Applitools-Dev/sdk/issues/3046)) ([0633809](https://github.com/Applitools-Dev/sdk/commit/06338099f44bfb149a5829f62c2f9b19e2392850)) | ||
| ## [1.8.2](https://github.com/Applitools-Dev/sdk/compare/js/utils@1.8.1...js/utils@1.8.2) (2025-05-11) | ||
@@ -4,0 +11,0 @@ |
+29
-1
@@ -26,3 +26,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.zip = exports.dedupAndMap = exports.deepEqual = exports.pluralize = exports.extend = exports.wrap = exports.batchify = exports.cachify = exports.absolutizeUrl = exports.removeUndefinedProps = exports.toUriEncoding = exports.toUnAnchoredUri = exports.toString = exports.toJSON = exports.sleep = exports.jwtDecode = exports.shortid = exports.guid = exports.getEnvValue = void 0; | ||
| exports.zip = exports.dedupAndMap = exports.deepEqual = exports.pluralize = exports.extend = exports.wrap = exports.batchify = exports.clearCachify = exports.cachify = exports.absolutizeUrl = exports.removeUndefinedProps = exports.toUriEncoding = exports.toUnAnchoredUri = exports.toString = exports.toJSON = exports.sleep = exports.jwtDecode = exports.shortid = exports.guid = exports.getEnvCaseInsensitive = exports.getEnvValue = void 0; | ||
| const buffer_1 = require("buffer"); | ||
@@ -43,2 +43,24 @@ const types = __importStar(require("./types")); | ||
| exports.getEnvValue = getEnvValue; | ||
| /** | ||
| * Retrieves the value of an environment variable in a case-insensitive manner. | ||
| * | ||
| * Traversing in order upper case, lower case and mixed case | ||
| * | ||
| * @param {string} key - The name of the environment variable to lookup. | ||
| * @return {string | undefined} The value of the environment variable if found, or undefined if not found. | ||
| */ | ||
| function getEnvCaseInsensitive(key) { | ||
| const upperKey = key.toUpperCase(); | ||
| if (process.env[upperKey]) { | ||
| return process.env[upperKey]; | ||
| } | ||
| const lowerKey = key.toLowerCase(); | ||
| if (process.env[lowerKey]) { | ||
| return process.env[lowerKey]; | ||
| } | ||
| // mixed case traversal | ||
| const foundKey = Object.keys(process.env).find(k => k.toLowerCase() === key.toLowerCase()); | ||
| return foundKey ? process.env[foundKey] : undefined; | ||
| } | ||
| exports.getEnvCaseInsensitive = getEnvCaseInsensitive; | ||
| function guid() { | ||
@@ -113,2 +135,3 @@ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => { | ||
| const cache = new Map(); | ||
| caches.push(cache); | ||
| const funcWithCache = ((...args) => { | ||
@@ -136,2 +159,7 @@ var _a; | ||
| exports.cachify = cachify; | ||
| const caches = []; | ||
| function clearCachify() { | ||
| caches.forEach(cache => cache.clear()); | ||
| } | ||
| exports.clearCachify = clearCachify; | ||
| function batchify(func, { timeout, maxPending }) { | ||
@@ -138,0 +166,0 @@ const pendingInputs = new Map(); |
+1
-1
| { | ||
| "name": "@applitools/utils", | ||
| "version": "1.8.2", | ||
| "version": "1.9.0", | ||
| "keywords": [ | ||
@@ -5,0 +5,0 @@ "applitools", |
+10
-0
| export declare function getEnvValue<T extends 'boolean' | 'number' | 'string' = 'string'>(name: string, type?: T): T extends 'boolean' ? boolean : T extends 'number' ? number : T extends 'string' ? string : string | undefined; | ||
| /** | ||
| * Retrieves the value of an environment variable in a case-insensitive manner. | ||
| * | ||
| * Traversing in order upper case, lower case and mixed case | ||
| * | ||
| * @param {string} key - The name of the environment variable to lookup. | ||
| * @return {string | undefined} The value of the environment variable if found, or undefined if not found. | ||
| */ | ||
| export declare function getEnvCaseInsensitive(key: string): string | undefined; | ||
| export declare function guid(): string; | ||
@@ -31,2 +40,3 @@ export declare function shortid(): string; | ||
| }; | ||
| export declare function clearCachify(): void; | ||
| export declare function batchify<TFunc extends (batch: [TInput, { | ||
@@ -33,0 +43,0 @@ resolve(result?: TResult): void; |
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
93831
2.02%1698
2.29%11
120%