@alextheman/utility 5.26.1 → 5.28.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/dist/index.cjs +32 -4
- package/dist/index.d.cts +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +31 -5
- package/dist/internal/index.cjs +4 -2
- package/dist/internal/index.js +4 -2
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -727,6 +727,30 @@ function isMonthlyMultiple(firstDate, secondDate) {
|
|
|
727
727
|
return firstDate.getDate() === secondDate.getDate();
|
|
728
728
|
}
|
|
729
729
|
//#endregion
|
|
730
|
+
//#region src/root/functions/date/minutesToMs.ts
|
|
731
|
+
/**
|
|
732
|
+
* Converts a given number of minutes into milliseconds.
|
|
733
|
+
*
|
|
734
|
+
* @param minutes - The amount of minutes.
|
|
735
|
+
*
|
|
736
|
+
* @returns The equivalent amount of milliseconds.
|
|
737
|
+
*/
|
|
738
|
+
function minutesToMs(minutes) {
|
|
739
|
+
return minutes * 60 * 1e3;
|
|
740
|
+
}
|
|
741
|
+
//#endregion
|
|
742
|
+
//#region src/root/functions/date/secondsToMs.ts
|
|
743
|
+
/**
|
|
744
|
+
* Converts a given number of seconds into milliseconds.
|
|
745
|
+
*
|
|
746
|
+
* @param seconds - The amount of seconds.
|
|
747
|
+
*
|
|
748
|
+
* @returns The equivalent amount of milliseconds.
|
|
749
|
+
*/
|
|
750
|
+
function secondsToMs(seconds) {
|
|
751
|
+
return seconds * 1e3;
|
|
752
|
+
}
|
|
753
|
+
//#endregion
|
|
730
754
|
//#region src/root/functions/miscellaneous/convertFileToBase64.ts
|
|
731
755
|
/**
|
|
732
756
|
* Asynchronously converts a file to a base 64 string
|
|
@@ -1034,10 +1058,12 @@ function stringifyDotenv(contents, options) {
|
|
|
1034
1058
|
let result = "";
|
|
1035
1059
|
for (const key in contentsCopy) {
|
|
1036
1060
|
if (/[ \t\r\n]/.test(key)) throw new DataError$1({ [key]: contentsCopy[key] }, "INVALID_KEY", "Environment variables are not allowed to have whitespace.");
|
|
1037
|
-
if (quoteStyle === "none")
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1061
|
+
if (quoteStyle === "none") {
|
|
1062
|
+
if (/[ \t\r\n]/.test(contentsCopy[key]) || contentsCopy[key].includes("#") || contentsCopy[key].includes("=") || contentsCopy[key].includes("\\")) throw new DataError$1({ [key]: contentsCopy[key] }, "INCOMPATIBLE_QUOTE_STYLE", "Cannot use `{ quoteStyle: \"none\" }` when value has whitespace, #, =, or \\");
|
|
1063
|
+
else {
|
|
1064
|
+
result += `${key}=${contentsCopy[key]}\n`;
|
|
1065
|
+
continue;
|
|
1066
|
+
}
|
|
1041
1067
|
}
|
|
1042
1068
|
const rawValue = contentsCopy[key].replace(/\r?\n/g, String.raw`\n`);
|
|
1043
1069
|
const chosenQuoteCharacter = {
|
|
@@ -2125,6 +2151,7 @@ exports.isSameDate = isSameDate;
|
|
|
2125
2151
|
exports.isTemplateStringsArray = isTemplateStringsArray;
|
|
2126
2152
|
exports.kebabToCamel = kebabToCamel;
|
|
2127
2153
|
exports.memoizeAsync = memoizeAsync;
|
|
2154
|
+
exports.minutesToMs = minutesToMs;
|
|
2128
2155
|
exports.normaliseIndents = normaliseIndents;
|
|
2129
2156
|
exports.normalizeIndents = normalizeIndents;
|
|
2130
2157
|
exports.objectContainsKeys = objectContainsKeys;
|
|
@@ -2144,6 +2171,7 @@ exports.range = range;
|
|
|
2144
2171
|
exports.removeDuplicates = removeDuplicates;
|
|
2145
2172
|
exports.removeUndefinedFromObject = removeUndefinedFromObject;
|
|
2146
2173
|
exports.sayHello = sayHello;
|
|
2174
|
+
exports.secondsToMs = secondsToMs;
|
|
2147
2175
|
exports.sortBy = sortBy;
|
|
2148
2176
|
exports.stringListToArray = stringListToArray;
|
|
2149
2177
|
exports.stringifyDotenv = stringifyDotenv;
|
package/dist/index.d.cts
CHANGED
|
@@ -320,6 +320,26 @@ declare function isMonthlyMultiple(firstDate: Date, secondDate: Date): boolean;
|
|
|
320
320
|
*/
|
|
321
321
|
declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
|
|
322
322
|
//#endregion
|
|
323
|
+
//#region src/root/functions/date/minutesToMs.d.ts
|
|
324
|
+
/**
|
|
325
|
+
* Converts a given number of minutes into milliseconds.
|
|
326
|
+
*
|
|
327
|
+
* @param minutes - The amount of minutes.
|
|
328
|
+
*
|
|
329
|
+
* @returns The equivalent amount of milliseconds.
|
|
330
|
+
*/
|
|
331
|
+
declare function minutesToMs(minutes: number): number;
|
|
332
|
+
//#endregion
|
|
333
|
+
//#region src/root/functions/date/secondsToMs.d.ts
|
|
334
|
+
/**
|
|
335
|
+
* Converts a given number of seconds into milliseconds.
|
|
336
|
+
*
|
|
337
|
+
* @param seconds - The amount of seconds.
|
|
338
|
+
*
|
|
339
|
+
* @returns The equivalent amount of milliseconds.
|
|
340
|
+
*/
|
|
341
|
+
declare function secondsToMs(seconds: number): number;
|
|
342
|
+
//#endregion
|
|
323
343
|
//#region src/root/functions/miscellaneous/convertFileToBase64.d.ts
|
|
324
344
|
/**
|
|
325
345
|
* Asynchronously converts a file to a base 64 string
|
|
@@ -1494,14 +1514,15 @@ declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType exten
|
|
|
1494
1514
|
declare function zodFieldWrapper<SchemaType extends ZodType<unknown, string | null>>(schema: SchemaType): ZodType<z.infer<SchemaType>, string>;
|
|
1495
1515
|
//#endregion
|
|
1496
1516
|
//#region src/root/zod/az.d.ts
|
|
1517
|
+
type AzParsingErrorHandler<ErrorType extends Error = DataError$1> = ErrorType | ((zodError: z.ZodError<unknown>) => void | ErrorType);
|
|
1497
1518
|
declare const az: {
|
|
1498
1519
|
field: typeof zodFieldWrapper;
|
|
1499
1520
|
fieldNumber: () => ZodCoercedNumber<string | null>;
|
|
1500
1521
|
versionNumber: () => ZodType<VersionNumber, unknown>;
|
|
1501
1522
|
fieldDate: () => ZodCoercedDate<string | null>;
|
|
1502
1523
|
with: <SchemaType extends ZodType>(schema: SchemaType) => {
|
|
1503
|
-
parse: <ErrorType extends Error = DataError$1<Record<PropertyKey, unknown>, string>>(input: unknown, error?: ErrorType
|
|
1504
|
-
parseAsync: <ErrorType extends Error = DataError$1<Record<PropertyKey, unknown>, string>>(input: unknown, error?: ErrorType
|
|
1524
|
+
parse: <ErrorType extends Error = DataError$1<Record<PropertyKey, unknown>, string>>(input: unknown, error?: AzParsingErrorHandler<ErrorType>) => ReturnType<typeof parseZodSchema<SchemaType, ErrorType>>;
|
|
1525
|
+
parseAsync: <ErrorType extends Error = DataError$1<Record<PropertyKey, unknown>, string>>(input: unknown, error?: AzParsingErrorHandler<ErrorType>) => ReturnType<typeof parseZodSchemaAsync<SchemaType, ErrorType>>;
|
|
1505
1526
|
};
|
|
1506
1527
|
};
|
|
1507
1528
|
//#endregion
|
|
@@ -1511,4 +1532,4 @@ interface ZodParsingErrorData {
|
|
|
1511
1532
|
issues: Array<z.core.$ZodIssue>;
|
|
1512
1533
|
}
|
|
1513
1534
|
//#endregion
|
|
1514
|
-
export { APIError, type ArrayElement, type CallReturnType, type CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, FILE_PATH_REGEX_PATTERN, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, type KebabToCamelOptions, type NonNull, type NonUndefined, type NormaliseIndentsFunction, type NormaliseIndentsOptions, type NormalizeIndentsFunction, type NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, type ParallelTuple, type RecordKey, type RemoveUndefined, SortDirection, type StringListToArrayOptions, type ToTitleCaseOptions, UUID_PATTERN, UUID_REGEX, UUID_REGEX_PATTERN, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VERSION_NUMBER_REGEX_PATTERN, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, type ZodParsingErrorData, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, containsKeys, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeHTML, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, identity, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isNonNullableObject, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, memoizeAsync, normaliseIndents, normalizeIndents, objectContainsKeys, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, pickProperties, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, sortBy, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
|
1535
|
+
export { APIError, type ArrayElement, type AzParsingErrorHandler, type CallReturnType, type CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, FILE_PATH_REGEX_PATTERN, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, type KebabToCamelOptions, type NonNull, type NonUndefined, type NormaliseIndentsFunction, type NormaliseIndentsOptions, type NormalizeIndentsFunction, type NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, type ParallelTuple, type RecordKey, type RemoveUndefined, SortDirection, type StringListToArrayOptions, type ToTitleCaseOptions, UUID_PATTERN, UUID_REGEX, UUID_REGEX_PATTERN, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VERSION_NUMBER_REGEX_PATTERN, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, type ZodParsingErrorData, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, containsKeys, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeHTML, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, identity, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isNonNullableObject, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, memoizeAsync, minutesToMs, normaliseIndents, normalizeIndents, objectContainsKeys, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, pickProperties, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, secondsToMs, sortBy, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
package/dist/index.d.ts
CHANGED
|
@@ -320,6 +320,26 @@ declare function isMonthlyMultiple(firstDate: Date, secondDate: Date): boolean;
|
|
|
320
320
|
*/
|
|
321
321
|
declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
|
|
322
322
|
//#endregion
|
|
323
|
+
//#region src/root/functions/date/minutesToMs.d.ts
|
|
324
|
+
/**
|
|
325
|
+
* Converts a given number of minutes into milliseconds.
|
|
326
|
+
*
|
|
327
|
+
* @param minutes - The amount of minutes.
|
|
328
|
+
*
|
|
329
|
+
* @returns The equivalent amount of milliseconds.
|
|
330
|
+
*/
|
|
331
|
+
declare function minutesToMs(minutes: number): number;
|
|
332
|
+
//#endregion
|
|
333
|
+
//#region src/root/functions/date/secondsToMs.d.ts
|
|
334
|
+
/**
|
|
335
|
+
* Converts a given number of seconds into milliseconds.
|
|
336
|
+
*
|
|
337
|
+
* @param seconds - The amount of seconds.
|
|
338
|
+
*
|
|
339
|
+
* @returns The equivalent amount of milliseconds.
|
|
340
|
+
*/
|
|
341
|
+
declare function secondsToMs(seconds: number): number;
|
|
342
|
+
//#endregion
|
|
323
343
|
//#region src/root/functions/miscellaneous/convertFileToBase64.d.ts
|
|
324
344
|
/**
|
|
325
345
|
* Asynchronously converts a file to a base 64 string
|
|
@@ -1494,14 +1514,15 @@ declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType exten
|
|
|
1494
1514
|
declare function zodFieldWrapper<SchemaType extends ZodType<unknown, string | null>>(schema: SchemaType): ZodType<z.infer<SchemaType>, string>;
|
|
1495
1515
|
//#endregion
|
|
1496
1516
|
//#region src/root/zod/az.d.ts
|
|
1517
|
+
type AzParsingErrorHandler<ErrorType extends Error = DataError$1> = ErrorType | ((zodError: z.ZodError<unknown>) => void | ErrorType);
|
|
1497
1518
|
declare const az: {
|
|
1498
1519
|
field: typeof zodFieldWrapper;
|
|
1499
1520
|
fieldNumber: () => ZodCoercedNumber<string | null>;
|
|
1500
1521
|
versionNumber: () => ZodType<VersionNumber, unknown>;
|
|
1501
1522
|
fieldDate: () => ZodCoercedDate<string | null>;
|
|
1502
1523
|
with: <SchemaType extends ZodType>(schema: SchemaType) => {
|
|
1503
|
-
parse: <ErrorType extends Error = DataError$1<Record<PropertyKey, unknown>, string>>(input: unknown, error?: ErrorType
|
|
1504
|
-
parseAsync: <ErrorType extends Error = DataError$1<Record<PropertyKey, unknown>, string>>(input: unknown, error?: ErrorType
|
|
1524
|
+
parse: <ErrorType extends Error = DataError$1<Record<PropertyKey, unknown>, string>>(input: unknown, error?: AzParsingErrorHandler<ErrorType>) => ReturnType<typeof parseZodSchema<SchemaType, ErrorType>>;
|
|
1525
|
+
parseAsync: <ErrorType extends Error = DataError$1<Record<PropertyKey, unknown>, string>>(input: unknown, error?: AzParsingErrorHandler<ErrorType>) => ReturnType<typeof parseZodSchemaAsync<SchemaType, ErrorType>>;
|
|
1505
1526
|
};
|
|
1506
1527
|
};
|
|
1507
1528
|
//#endregion
|
|
@@ -1511,4 +1532,4 @@ interface ZodParsingErrorData {
|
|
|
1511
1532
|
issues: Array<z.core.$ZodIssue>;
|
|
1512
1533
|
}
|
|
1513
1534
|
//#endregion
|
|
1514
|
-
export { APIError, type ArrayElement, type CallReturnType, type CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, FILE_PATH_REGEX_PATTERN, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, type KebabToCamelOptions, type NonNull, type NonUndefined, type NormaliseIndentsFunction, type NormaliseIndentsOptions, type NormalizeIndentsFunction, type NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, type ParallelTuple, type RecordKey, type RemoveUndefined, SortDirection, type StringListToArrayOptions, type ToTitleCaseOptions, UUID_PATTERN, UUID_REGEX, UUID_REGEX_PATTERN, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VERSION_NUMBER_REGEX_PATTERN, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, type ZodParsingErrorData, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, containsKeys, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeHTML, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, identity, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isNonNullableObject, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, memoizeAsync, normaliseIndents, normalizeIndents, objectContainsKeys, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, pickProperties, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, sortBy, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
|
1535
|
+
export { APIError, type ArrayElement, type AzParsingErrorHandler, type CallReturnType, type CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, FILE_PATH_REGEX_PATTERN, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, type KebabToCamelOptions, type NonNull, type NonUndefined, type NormaliseIndentsFunction, type NormaliseIndentsOptions, type NormalizeIndentsFunction, type NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, type ParallelTuple, type RecordKey, type RemoveUndefined, SortDirection, type StringListToArrayOptions, type ToTitleCaseOptions, UUID_PATTERN, UUID_REGEX, UUID_REGEX_PATTERN, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VERSION_NUMBER_REGEX_PATTERN, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, type ZodParsingErrorData, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, containsKeys, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeHTML, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, identity, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isNonNullableObject, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, memoizeAsync, minutesToMs, normaliseIndents, normalizeIndents, objectContainsKeys, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, pickProperties, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, secondsToMs, sortBy, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
package/dist/index.js
CHANGED
|
@@ -703,6 +703,30 @@ function isMonthlyMultiple(firstDate, secondDate) {
|
|
|
703
703
|
return firstDate.getDate() === secondDate.getDate();
|
|
704
704
|
}
|
|
705
705
|
//#endregion
|
|
706
|
+
//#region src/root/functions/date/minutesToMs.ts
|
|
707
|
+
/**
|
|
708
|
+
* Converts a given number of minutes into milliseconds.
|
|
709
|
+
*
|
|
710
|
+
* @param minutes - The amount of minutes.
|
|
711
|
+
*
|
|
712
|
+
* @returns The equivalent amount of milliseconds.
|
|
713
|
+
*/
|
|
714
|
+
function minutesToMs(minutes) {
|
|
715
|
+
return minutes * 60 * 1e3;
|
|
716
|
+
}
|
|
717
|
+
//#endregion
|
|
718
|
+
//#region src/root/functions/date/secondsToMs.ts
|
|
719
|
+
/**
|
|
720
|
+
* Converts a given number of seconds into milliseconds.
|
|
721
|
+
*
|
|
722
|
+
* @param seconds - The amount of seconds.
|
|
723
|
+
*
|
|
724
|
+
* @returns The equivalent amount of milliseconds.
|
|
725
|
+
*/
|
|
726
|
+
function secondsToMs(seconds) {
|
|
727
|
+
return seconds * 1e3;
|
|
728
|
+
}
|
|
729
|
+
//#endregion
|
|
706
730
|
//#region src/root/functions/miscellaneous/convertFileToBase64.ts
|
|
707
731
|
/**
|
|
708
732
|
* Asynchronously converts a file to a base 64 string
|
|
@@ -1010,10 +1034,12 @@ function stringifyDotenv(contents, options) {
|
|
|
1010
1034
|
let result = "";
|
|
1011
1035
|
for (const key in contentsCopy) {
|
|
1012
1036
|
if (/[ \t\r\n]/.test(key)) throw new DataError$1({ [key]: contentsCopy[key] }, "INVALID_KEY", "Environment variables are not allowed to have whitespace.");
|
|
1013
|
-
if (quoteStyle === "none")
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1037
|
+
if (quoteStyle === "none") {
|
|
1038
|
+
if (/[ \t\r\n]/.test(contentsCopy[key]) || contentsCopy[key].includes("#") || contentsCopy[key].includes("=") || contentsCopy[key].includes("\\")) throw new DataError$1({ [key]: contentsCopy[key] }, "INCOMPATIBLE_QUOTE_STYLE", "Cannot use `{ quoteStyle: \"none\" }` when value has whitespace, #, =, or \\");
|
|
1039
|
+
else {
|
|
1040
|
+
result += `${key}=${contentsCopy[key]}\n`;
|
|
1041
|
+
continue;
|
|
1042
|
+
}
|
|
1017
1043
|
}
|
|
1018
1044
|
const rawValue = contentsCopy[key].replace(/\r?\n/g, String.raw`\n`);
|
|
1019
1045
|
const chosenQuoteCharacter = {
|
|
@@ -2051,4 +2077,4 @@ const UUID_PATTERN = UUID_REGEX_PATTERN;
|
|
|
2051
2077
|
/** @deprecated This has been renamed to `VERSION_NUMBER_REGEX_PATTERN`. */
|
|
2052
2078
|
const VERSION_NUMBER_PATTERN = String.raw`^(?:v)?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$`;
|
|
2053
2079
|
//#endregion
|
|
2054
|
-
export { APIError, DataError, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, FILE_PATH_REGEX_PATTERN, ONE_DAY_IN_MILLISECONDS, SortDirection, UUID_PATTERN, UUID_REGEX, UUID_REGEX_PATTERN, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VERSION_NUMBER_REGEX_PATTERN, VersionNumber, VersionType, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, containsKeys, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeHTML, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, identity, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isNonNullableObject, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, memoizeAsync, normaliseIndents, normalizeIndents, objectContainsKeys, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, pickProperties, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, sortBy, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
|
2080
|
+
export { APIError, DataError, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, FILE_PATH_REGEX_PATTERN, ONE_DAY_IN_MILLISECONDS, SortDirection, UUID_PATTERN, UUID_REGEX, UUID_REGEX_PATTERN, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VERSION_NUMBER_REGEX_PATTERN, VersionNumber, VersionType, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, containsKeys, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeHTML, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, identity, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isNonNullableObject, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, memoizeAsync, minutesToMs, normaliseIndents, normalizeIndents, objectContainsKeys, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, pickProperties, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, secondsToMs, sortBy, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
package/dist/internal/index.cjs
CHANGED
|
@@ -826,8 +826,10 @@ async function getPackageJsonContents(directory, options) {
|
|
|
826
826
|
try {
|
|
827
827
|
return JSON.parse(await (0, node_fs_promises.readFile)(getPackageJsonPath(directory), "utf-8"));
|
|
828
828
|
} catch (error) {
|
|
829
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
830
|
-
|
|
829
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
830
|
+
if (strict) throw packageJsonNotFoundError(directory);
|
|
831
|
+
else return null;
|
|
832
|
+
}
|
|
831
833
|
throw error;
|
|
832
834
|
}
|
|
833
835
|
}
|
package/dist/internal/index.js
CHANGED
|
@@ -801,8 +801,10 @@ async function getPackageJsonContents(directory, options) {
|
|
|
801
801
|
try {
|
|
802
802
|
return JSON.parse(await readFile(getPackageJsonPath(directory), "utf-8"));
|
|
803
803
|
} catch (error) {
|
|
804
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
805
|
-
|
|
804
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
805
|
+
if (strict) throw packageJsonNotFoundError(directory);
|
|
806
|
+
else return null;
|
|
807
|
+
}
|
|
806
808
|
throw error;
|
|
807
809
|
}
|
|
808
810
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alextheman/utility",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.28.0",
|
|
4
4
|
"description": "Helpful utility functions.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,29 +42,29 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"dotenv": "17.4.2",
|
|
45
|
-
"execa": "10.0.
|
|
45
|
+
"execa": "10.0.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@alextheman/eslint-plugin": "5.18.
|
|
49
|
-
"@types/node": "26.
|
|
50
|
-
"alex-c-line": "2.13.
|
|
48
|
+
"@alextheman/eslint-plugin": "5.18.1",
|
|
49
|
+
"@types/node": "26.2.0",
|
|
50
|
+
"alex-c-line": "2.13.1",
|
|
51
51
|
"cross-env": "10.1.0",
|
|
52
52
|
"dotenv-cli": "11.0.0",
|
|
53
|
-
"eslint": "10.8.
|
|
54
|
-
"globals": "17.
|
|
53
|
+
"eslint": "10.8.1",
|
|
54
|
+
"globals": "17.11.0",
|
|
55
55
|
"husky": "9.1.7",
|
|
56
56
|
"jsdom": "30.0.1",
|
|
57
57
|
"markdownlint-cli2": "0.23.2",
|
|
58
58
|
"prettier": "3.9.6",
|
|
59
59
|
"tempy": "3.2.0",
|
|
60
60
|
"tsdown": "0.22.14",
|
|
61
|
-
"tsx": "4.23.
|
|
61
|
+
"tsx": "4.23.12",
|
|
62
62
|
"typedoc": "0.28.20",
|
|
63
63
|
"typedoc-plugin-markdown": "4.12.0",
|
|
64
64
|
"typedoc-rhineai-theme": "1.2.0",
|
|
65
65
|
"typescript": "6.0.3",
|
|
66
|
-
"typescript-eslint": "8.
|
|
67
|
-
"vite": "8.2.
|
|
66
|
+
"typescript-eslint": "8.67.0",
|
|
67
|
+
"vite": "8.2.1",
|
|
68
68
|
"vitest": "4.1.10",
|
|
69
69
|
"zod": "4.4.3"
|
|
70
70
|
},
|