@apify/utilities 2.24.1 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.cjs +14 -0
- package/cjs/index.cjs.map +1 -1
- package/cjs/index.d.ts +12 -1
- package/esm/index.d.mts +12 -1
- package/esm/index.mjs +13 -0
- package/esm/index.mjs.map +1 -1
- package/package.json +2 -2
package/cjs/index.d.ts
CHANGED
|
@@ -592,4 +592,15 @@ declare function createStorageContentSignatureAsync({ resourceId, urlSigningSecr
|
|
|
592
592
|
version?: number;
|
|
593
593
|
}): Promise<string>;
|
|
594
594
|
|
|
595
|
-
|
|
595
|
+
/**
|
|
596
|
+
* Strictly parses a value to a boolean, returning `null` if the value is invalid.
|
|
597
|
+
* - Returns `true` for: `true`, `1`, `'1'`, `'true'` (case-insensitive).
|
|
598
|
+
* - Returns `false` for: `false`, `0`, `'0'`, `'false'` (case-insensitive).
|
|
599
|
+
* - Returns `null` for any other value.
|
|
600
|
+
*
|
|
601
|
+
* @param value - The value to parse (unknown type).
|
|
602
|
+
* @returns {boolean | null} The parsed boolean or null if the input is invalid.
|
|
603
|
+
*/
|
|
604
|
+
declare const parseBooleanOrNull: (value: unknown) => boolean | null;
|
|
605
|
+
|
|
606
|
+
export { type BetterIntervalID, CHECK_TYPES, CodeHashManager, CodeHashMetaKey, HealthChecker, InvalidJsonError, InvalidVariableError, JsonVariable, ParseJsonlStream, RetryableError, WebhookPayloadTemplate, betterClearInterval, betterSetInterval, buildOrVersionNumberIntToStr, checkParamPrototypeOrThrow, concatStreamToBuffer, configureLogger, createHmacSignature, createHmacSignatureAsync, createInjectableRegExp, createStorageContentSignature, createStorageContentSignatureAsync, cryptoRandomObjectId, dateToString, delayPromise, deterministicUniqueId, escapeForBson, escapePropertyName, escapeRegExp, expressErrorHandler, getOrdinalSuffix, getRandomInt, http404Route, isBadForMongo, isBuffer, isForbiddenUsername, isNullOrUndefined, isUrlRelative, jsonStringifyExtended, leftpad, markedDecreaseHeadsLevel, markedSetNofollowLinks, normalizeUrl, parseBooleanOrNull, parseDateFromJson, parseUrl, privateDecrypt, promisifyServerListen, publicEncrypt, readStreamToString, removeFromArray, retryWithExpBackoff, separateImports, sequentializePromises, splitFullName, timeoutPromise, traverseObject, truncate, unescapeFromBson, unescapePropertyName, weightedAverage };
|
package/esm/index.d.mts
CHANGED
|
@@ -592,4 +592,15 @@ declare function createStorageContentSignatureAsync({ resourceId, urlSigningSecr
|
|
|
592
592
|
version?: number;
|
|
593
593
|
}): Promise<string>;
|
|
594
594
|
|
|
595
|
-
|
|
595
|
+
/**
|
|
596
|
+
* Strictly parses a value to a boolean, returning `null` if the value is invalid.
|
|
597
|
+
* - Returns `true` for: `true`, `1`, `'1'`, `'true'` (case-insensitive).
|
|
598
|
+
* - Returns `false` for: `false`, `0`, `'0'`, `'false'` (case-insensitive).
|
|
599
|
+
* - Returns `null` for any other value.
|
|
600
|
+
*
|
|
601
|
+
* @param value - The value to parse (unknown type).
|
|
602
|
+
* @returns {boolean | null} The parsed boolean or null if the input is invalid.
|
|
603
|
+
*/
|
|
604
|
+
declare const parseBooleanOrNull: (value: unknown) => boolean | null;
|
|
605
|
+
|
|
606
|
+
export { type BetterIntervalID, CHECK_TYPES, CodeHashManager, CodeHashMetaKey, HealthChecker, InvalidJsonError, InvalidVariableError, JsonVariable, ParseJsonlStream, RetryableError, WebhookPayloadTemplate, betterClearInterval, betterSetInterval, buildOrVersionNumberIntToStr, checkParamPrototypeOrThrow, concatStreamToBuffer, configureLogger, createHmacSignature, createHmacSignatureAsync, createInjectableRegExp, createStorageContentSignature, createStorageContentSignatureAsync, cryptoRandomObjectId, dateToString, delayPromise, deterministicUniqueId, escapeForBson, escapePropertyName, escapeRegExp, expressErrorHandler, getOrdinalSuffix, getRandomInt, http404Route, isBadForMongo, isBuffer, isForbiddenUsername, isNullOrUndefined, isUrlRelative, jsonStringifyExtended, leftpad, markedDecreaseHeadsLevel, markedSetNofollowLinks, normalizeUrl, parseBooleanOrNull, parseDateFromJson, parseUrl, privateDecrypt, promisifyServerListen, publicEncrypt, readStreamToString, removeFromArray, retryWithExpBackoff, separateImports, sequentializePromises, splitFullName, timeoutPromise, traverseObject, truncate, unescapeFromBson, unescapePropertyName, weightedAverage };
|
package/esm/index.mjs
CHANGED
|
@@ -1952,6 +1952,18 @@ async function createStorageContentSignatureAsync({
|
|
|
1952
1952
|
return typedArrayToBase64Url(new TextEncoder().encode(`${version}.${expiresAt}.${hmac}`));
|
|
1953
1953
|
}
|
|
1954
1954
|
__name(createStorageContentSignatureAsync, "createStorageContentSignatureAsync");
|
|
1955
|
+
|
|
1956
|
+
// src/parse_boolean.ts
|
|
1957
|
+
var parseBooleanOrNull = /* @__PURE__ */ __name((value) => {
|
|
1958
|
+
if (value === true || value === 1) return true;
|
|
1959
|
+
if (value === false || value === 0) return false;
|
|
1960
|
+
if (typeof value === "string") {
|
|
1961
|
+
const lowerValue = value.trim().toLowerCase();
|
|
1962
|
+
if (lowerValue === "true" || lowerValue === "1") return true;
|
|
1963
|
+
if (lowerValue === "false" || lowerValue === "0") return false;
|
|
1964
|
+
}
|
|
1965
|
+
return null;
|
|
1966
|
+
}, "parseBooleanOrNull");
|
|
1955
1967
|
export {
|
|
1956
1968
|
CHECK_TYPES,
|
|
1957
1969
|
CodeHashManager,
|
|
@@ -1995,6 +2007,7 @@ export {
|
|
|
1995
2007
|
markedDecreaseHeadsLevel,
|
|
1996
2008
|
markedSetNofollowLinks,
|
|
1997
2009
|
normalizeUrl,
|
|
2010
|
+
parseBooleanOrNull,
|
|
1998
2011
|
parseDateFromJson,
|
|
1999
2012
|
parseUrl,
|
|
2000
2013
|
privateDecrypt,
|