@alextheman/utility 4.7.0 → 4.9.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 +54 -13
- package/dist/index.d.cts +23 -2
- package/dist/index.d.ts +23 -2
- package/dist/index.js +54 -14
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -851,10 +851,38 @@ function parseBoolean(inputString) {
|
|
|
851
851
|
var parseBoolean_default = parseBoolean;
|
|
852
852
|
|
|
853
853
|
//#endregion
|
|
854
|
-
//#region src/functions/parsers/
|
|
854
|
+
//#region src/functions/parsers/zod/_parseZodSchema.ts
|
|
855
|
+
function _parseZodSchema(parsedResult, data, onError) {
|
|
856
|
+
if (!parsedResult.success) {
|
|
857
|
+
if (onError) {
|
|
858
|
+
if (onError instanceof Error) throw onError;
|
|
859
|
+
else if (typeof onError === "function") {
|
|
860
|
+
const evaluatedError = onError(parsedResult.error);
|
|
861
|
+
if (evaluatedError instanceof Error) throw evaluatedError;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
const allErrorCodes = {};
|
|
865
|
+
for (const issue of parsedResult.error.issues) {
|
|
866
|
+
const code = issue.code.toUpperCase();
|
|
867
|
+
allErrorCodes[code] = (allErrorCodes[code] ?? 0) + 1;
|
|
868
|
+
}
|
|
869
|
+
throw new DataError_default(data, Object.entries(allErrorCodes).toSorted(([_, firstCount], [__, secondCount]) => {
|
|
870
|
+
return secondCount - firstCount;
|
|
871
|
+
}).map(([code, count], _, allErrorCodes$1) => {
|
|
872
|
+
return allErrorCodes$1.length === 1 && count === 1 ? code : `${code}×${count}`;
|
|
873
|
+
}).join(","), `\n\n${zod.default.prettifyError(parsedResult.error)}\n`);
|
|
874
|
+
}
|
|
875
|
+
return parsedResult.data;
|
|
876
|
+
}
|
|
877
|
+
var _parseZodSchema_default = _parseZodSchema;
|
|
878
|
+
|
|
879
|
+
//#endregion
|
|
880
|
+
//#region src/functions/parsers/zod/parseZodSchema.ts
|
|
855
881
|
/**
|
|
856
882
|
* An alternative function to zodSchema.parse() that can be used to strictly parse Zod schemas.
|
|
857
883
|
*
|
|
884
|
+
* NOTE: Use `parseZodSchemaAsync` if your schema includes an asynchronous function.
|
|
885
|
+
*
|
|
858
886
|
* @category Parsers
|
|
859
887
|
*
|
|
860
888
|
* @template SchemaType - The Zod schema type.
|
|
@@ -869,18 +897,7 @@ var parseBoolean_default = parseBoolean;
|
|
|
869
897
|
* @returns The parsed data from the Zod schema.
|
|
870
898
|
*/
|
|
871
899
|
function parseZodSchema(schema, data, onError) {
|
|
872
|
-
|
|
873
|
-
if (!parsedResult.success) {
|
|
874
|
-
if (onError) {
|
|
875
|
-
if (onError instanceof Error) throw onError;
|
|
876
|
-
else if (typeof onError === "function") {
|
|
877
|
-
const evaluatedError = onError(parsedResult.error);
|
|
878
|
-
if (evaluatedError instanceof Error) throw evaluatedError;
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
throw new DataError_default(data, parsedResult.error.issues[0]?.code?.toUpperCase(), parsedResult.error.issues[0]?.message);
|
|
882
|
-
}
|
|
883
|
-
return parsedResult.data;
|
|
900
|
+
return _parseZodSchema_default(schema.safeParse(data), data, onError);
|
|
884
901
|
}
|
|
885
902
|
var parseZodSchema_default = parseZodSchema;
|
|
886
903
|
|
|
@@ -964,6 +981,29 @@ function parseVersionType(data) {
|
|
|
964
981
|
}
|
|
965
982
|
var parseVersionType_default = parseVersionType;
|
|
966
983
|
|
|
984
|
+
//#endregion
|
|
985
|
+
//#region src/functions/parsers/zod/parseZodSchemaAsync.ts
|
|
986
|
+
/**
|
|
987
|
+
* An alternative function to zodSchema.parseAsync() that can be used to strictly parse asynchronous Zod schemas.
|
|
988
|
+
*
|
|
989
|
+
* @category Parsers
|
|
990
|
+
*
|
|
991
|
+
* @template SchemaType - The Zod schema type.
|
|
992
|
+
* @template ErrorType - The type of error to throw on invalid data.
|
|
993
|
+
*
|
|
994
|
+
* @param schema - The Zod schema to use in parsing.
|
|
995
|
+
* @param data - The data to parse.
|
|
996
|
+
* @param onError - A custom error to throw on invalid data (defaults to `DataError`). May either be the error itself, or a function that returns the error or nothing. If nothing is returned, the default error is thrown instead.
|
|
997
|
+
*
|
|
998
|
+
* @throws {DataError} If the given data cannot be parsed according to the schema.
|
|
999
|
+
*
|
|
1000
|
+
* @returns The parsed data from the Zod schema.
|
|
1001
|
+
*/
|
|
1002
|
+
async function parseZodSchemaAsync(schema, data, onError) {
|
|
1003
|
+
return _parseZodSchema_default(await schema.safeParseAsync(data), data, onError);
|
|
1004
|
+
}
|
|
1005
|
+
var parseZodSchemaAsync_default = parseZodSchemaAsync;
|
|
1006
|
+
|
|
967
1007
|
//#endregion
|
|
968
1008
|
//#region src/functions/recursive/deepCopy.ts
|
|
969
1009
|
function callDeepCopy(input) {
|
|
@@ -1518,6 +1558,7 @@ exports.parseIntStrict = parseIntStrict_default;
|
|
|
1518
1558
|
exports.parseVersion = parseVersion_default;
|
|
1519
1559
|
exports.parseVersionType = parseVersionType_default;
|
|
1520
1560
|
exports.parseZodSchema = parseZodSchema_default;
|
|
1561
|
+
exports.parseZodSchemaAsync = parseZodSchemaAsync_default;
|
|
1521
1562
|
exports.randomiseArray = randomiseArray_default;
|
|
1522
1563
|
exports.range = range_default;
|
|
1523
1564
|
exports.removeDuplicates = removeDuplicates_default;
|
package/dist/index.d.cts
CHANGED
|
@@ -678,10 +678,12 @@ type VersionType = CreateEnumType<typeof VersionType>;
|
|
|
678
678
|
*/
|
|
679
679
|
declare function parseVersionType(data: unknown): VersionType;
|
|
680
680
|
//#endregion
|
|
681
|
-
//#region src/functions/parsers/parseZodSchema.d.ts
|
|
681
|
+
//#region src/functions/parsers/zod/parseZodSchema.d.ts
|
|
682
682
|
/**
|
|
683
683
|
* An alternative function to zodSchema.parse() that can be used to strictly parse Zod schemas.
|
|
684
684
|
*
|
|
685
|
+
* NOTE: Use `parseZodSchemaAsync` if your schema includes an asynchronous function.
|
|
686
|
+
*
|
|
685
687
|
* @category Parsers
|
|
686
688
|
*
|
|
687
689
|
* @template SchemaType - The Zod schema type.
|
|
@@ -697,6 +699,25 @@ declare function parseVersionType(data: unknown): VersionType;
|
|
|
697
699
|
*/
|
|
698
700
|
declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Error>(schema: SchemaType, data: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): z.infer<SchemaType>;
|
|
699
701
|
//#endregion
|
|
702
|
+
//#region src/functions/parsers/zod/parseZodSchemaAsync.d.ts
|
|
703
|
+
/**
|
|
704
|
+
* An alternative function to zodSchema.parseAsync() that can be used to strictly parse asynchronous Zod schemas.
|
|
705
|
+
*
|
|
706
|
+
* @category Parsers
|
|
707
|
+
*
|
|
708
|
+
* @template SchemaType - The Zod schema type.
|
|
709
|
+
* @template ErrorType - The type of error to throw on invalid data.
|
|
710
|
+
*
|
|
711
|
+
* @param schema - The Zod schema to use in parsing.
|
|
712
|
+
* @param data - The data to parse.
|
|
713
|
+
* @param onError - A custom error to throw on invalid data (defaults to `DataError`). May either be the error itself, or a function that returns the error or nothing. If nothing is returned, the default error is thrown instead.
|
|
714
|
+
*
|
|
715
|
+
* @throws {DataError} If the given data cannot be parsed according to the schema.
|
|
716
|
+
*
|
|
717
|
+
* @returns The parsed data from the Zod schema.
|
|
718
|
+
*/
|
|
719
|
+
declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType extends Error>(schema: SchemaType, data: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): Promise<z.infer<SchemaType>>;
|
|
720
|
+
//#endregion
|
|
700
721
|
//#region src/functions/recursive/deepCopy.d.ts
|
|
701
722
|
/**
|
|
702
723
|
* Deeply copies an object or array such that all child objects/arrays are also copied.
|
|
@@ -1051,4 +1072,4 @@ interface ParseVersionOptions {
|
|
|
1051
1072
|
*/
|
|
1052
1073
|
declare function parseVersion(input: string, options?: ParseVersionOptions): string;
|
|
1053
1074
|
//#endregion
|
|
1054
|
-
export { APIError, ArrayElement, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, IncrementVersionOptions, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, OptionalOnCondition, ParallelTuple, ParseVersionOptions, RecordKey, StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getRandomNumber, getRecordKeys, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, randomiseArray, range, removeDuplicates, stringListToArray, stringifyDotenv, truncate, wait };
|
|
1075
|
+
export { APIError, ArrayElement, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, IncrementVersionOptions, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, OptionalOnCondition, ParallelTuple, ParseVersionOptions, RecordKey, StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getRandomNumber, getRecordKeys, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, stringListToArray, stringifyDotenv, truncate, wait };
|
package/dist/index.d.ts
CHANGED
|
@@ -678,10 +678,12 @@ type VersionType = CreateEnumType<typeof VersionType>;
|
|
|
678
678
|
*/
|
|
679
679
|
declare function parseVersionType(data: unknown): VersionType;
|
|
680
680
|
//#endregion
|
|
681
|
-
//#region src/functions/parsers/parseZodSchema.d.ts
|
|
681
|
+
//#region src/functions/parsers/zod/parseZodSchema.d.ts
|
|
682
682
|
/**
|
|
683
683
|
* An alternative function to zodSchema.parse() that can be used to strictly parse Zod schemas.
|
|
684
684
|
*
|
|
685
|
+
* NOTE: Use `parseZodSchemaAsync` if your schema includes an asynchronous function.
|
|
686
|
+
*
|
|
685
687
|
* @category Parsers
|
|
686
688
|
*
|
|
687
689
|
* @template SchemaType - The Zod schema type.
|
|
@@ -697,6 +699,25 @@ declare function parseVersionType(data: unknown): VersionType;
|
|
|
697
699
|
*/
|
|
698
700
|
declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Error>(schema: SchemaType, data: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): z$1.infer<SchemaType>;
|
|
699
701
|
//#endregion
|
|
702
|
+
//#region src/functions/parsers/zod/parseZodSchemaAsync.d.ts
|
|
703
|
+
/**
|
|
704
|
+
* An alternative function to zodSchema.parseAsync() that can be used to strictly parse asynchronous Zod schemas.
|
|
705
|
+
*
|
|
706
|
+
* @category Parsers
|
|
707
|
+
*
|
|
708
|
+
* @template SchemaType - The Zod schema type.
|
|
709
|
+
* @template ErrorType - The type of error to throw on invalid data.
|
|
710
|
+
*
|
|
711
|
+
* @param schema - The Zod schema to use in parsing.
|
|
712
|
+
* @param data - The data to parse.
|
|
713
|
+
* @param onError - A custom error to throw on invalid data (defaults to `DataError`). May either be the error itself, or a function that returns the error or nothing. If nothing is returned, the default error is thrown instead.
|
|
714
|
+
*
|
|
715
|
+
* @throws {DataError} If the given data cannot be parsed according to the schema.
|
|
716
|
+
*
|
|
717
|
+
* @returns The parsed data from the Zod schema.
|
|
718
|
+
*/
|
|
719
|
+
declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType extends Error>(schema: SchemaType, data: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): Promise<z$1.infer<SchemaType>>;
|
|
720
|
+
//#endregion
|
|
700
721
|
//#region src/functions/recursive/deepCopy.d.ts
|
|
701
722
|
/**
|
|
702
723
|
* Deeply copies an object or array such that all child objects/arrays are also copied.
|
|
@@ -1051,4 +1072,4 @@ interface ParseVersionOptions {
|
|
|
1051
1072
|
*/
|
|
1052
1073
|
declare function parseVersion(input: string, options?: ParseVersionOptions): string;
|
|
1053
1074
|
//#endregion
|
|
1054
|
-
export { APIError, ArrayElement, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, type IncrementVersionOptions, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, OptionalOnCondition, ParallelTuple, type ParseVersionOptions, RecordKey, StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getRandomNumber, getRecordKeys, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, randomiseArray, range, removeDuplicates, stringListToArray, stringifyDotenv, truncate, wait };
|
|
1075
|
+
export { APIError, ArrayElement, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, type IncrementVersionOptions, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, OptionalOnCondition, ParallelTuple, type ParseVersionOptions, RecordKey, StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getRandomNumber, getRecordKeys, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, stringListToArray, stringifyDotenv, truncate, wait };
|
package/dist/index.js
CHANGED
|
@@ -821,10 +821,38 @@ function parseBoolean(inputString) {
|
|
|
821
821
|
var parseBoolean_default = parseBoolean;
|
|
822
822
|
|
|
823
823
|
//#endregion
|
|
824
|
-
//#region src/functions/parsers/
|
|
824
|
+
//#region src/functions/parsers/zod/_parseZodSchema.ts
|
|
825
|
+
function _parseZodSchema(parsedResult, data, onError) {
|
|
826
|
+
if (!parsedResult.success) {
|
|
827
|
+
if (onError) {
|
|
828
|
+
if (onError instanceof Error) throw onError;
|
|
829
|
+
else if (typeof onError === "function") {
|
|
830
|
+
const evaluatedError = onError(parsedResult.error);
|
|
831
|
+
if (evaluatedError instanceof Error) throw evaluatedError;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
const allErrorCodes = {};
|
|
835
|
+
for (const issue of parsedResult.error.issues) {
|
|
836
|
+
const code = issue.code.toUpperCase();
|
|
837
|
+
allErrorCodes[code] = (allErrorCodes[code] ?? 0) + 1;
|
|
838
|
+
}
|
|
839
|
+
throw new DataError_default(data, Object.entries(allErrorCodes).toSorted(([_, firstCount], [__, secondCount]) => {
|
|
840
|
+
return secondCount - firstCount;
|
|
841
|
+
}).map(([code, count], _, allErrorCodes$1) => {
|
|
842
|
+
return allErrorCodes$1.length === 1 && count === 1 ? code : `${code}×${count}`;
|
|
843
|
+
}).join(","), `\n\n${z.prettifyError(parsedResult.error)}\n`);
|
|
844
|
+
}
|
|
845
|
+
return parsedResult.data;
|
|
846
|
+
}
|
|
847
|
+
var _parseZodSchema_default = _parseZodSchema;
|
|
848
|
+
|
|
849
|
+
//#endregion
|
|
850
|
+
//#region src/functions/parsers/zod/parseZodSchema.ts
|
|
825
851
|
/**
|
|
826
852
|
* An alternative function to zodSchema.parse() that can be used to strictly parse Zod schemas.
|
|
827
853
|
*
|
|
854
|
+
* NOTE: Use `parseZodSchemaAsync` if your schema includes an asynchronous function.
|
|
855
|
+
*
|
|
828
856
|
* @category Parsers
|
|
829
857
|
*
|
|
830
858
|
* @template SchemaType - The Zod schema type.
|
|
@@ -839,18 +867,7 @@ var parseBoolean_default = parseBoolean;
|
|
|
839
867
|
* @returns The parsed data from the Zod schema.
|
|
840
868
|
*/
|
|
841
869
|
function parseZodSchema(schema, data, onError) {
|
|
842
|
-
|
|
843
|
-
if (!parsedResult.success) {
|
|
844
|
-
if (onError) {
|
|
845
|
-
if (onError instanceof Error) throw onError;
|
|
846
|
-
else if (typeof onError === "function") {
|
|
847
|
-
const evaluatedError = onError(parsedResult.error);
|
|
848
|
-
if (evaluatedError instanceof Error) throw evaluatedError;
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
throw new DataError_default(data, parsedResult.error.issues[0]?.code?.toUpperCase(), parsedResult.error.issues[0]?.message);
|
|
852
|
-
}
|
|
853
|
-
return parsedResult.data;
|
|
870
|
+
return _parseZodSchema_default(schema.safeParse(data), data, onError);
|
|
854
871
|
}
|
|
855
872
|
var parseZodSchema_default = parseZodSchema;
|
|
856
873
|
|
|
@@ -934,6 +951,29 @@ function parseVersionType(data) {
|
|
|
934
951
|
}
|
|
935
952
|
var parseVersionType_default = parseVersionType;
|
|
936
953
|
|
|
954
|
+
//#endregion
|
|
955
|
+
//#region src/functions/parsers/zod/parseZodSchemaAsync.ts
|
|
956
|
+
/**
|
|
957
|
+
* An alternative function to zodSchema.parseAsync() that can be used to strictly parse asynchronous Zod schemas.
|
|
958
|
+
*
|
|
959
|
+
* @category Parsers
|
|
960
|
+
*
|
|
961
|
+
* @template SchemaType - The Zod schema type.
|
|
962
|
+
* @template ErrorType - The type of error to throw on invalid data.
|
|
963
|
+
*
|
|
964
|
+
* @param schema - The Zod schema to use in parsing.
|
|
965
|
+
* @param data - The data to parse.
|
|
966
|
+
* @param onError - A custom error to throw on invalid data (defaults to `DataError`). May either be the error itself, or a function that returns the error or nothing. If nothing is returned, the default error is thrown instead.
|
|
967
|
+
*
|
|
968
|
+
* @throws {DataError} If the given data cannot be parsed according to the schema.
|
|
969
|
+
*
|
|
970
|
+
* @returns The parsed data from the Zod schema.
|
|
971
|
+
*/
|
|
972
|
+
async function parseZodSchemaAsync(schema, data, onError) {
|
|
973
|
+
return _parseZodSchema_default(await schema.safeParseAsync(data), data, onError);
|
|
974
|
+
}
|
|
975
|
+
var parseZodSchemaAsync_default = parseZodSchemaAsync;
|
|
976
|
+
|
|
937
977
|
//#endregion
|
|
938
978
|
//#region src/functions/recursive/deepCopy.ts
|
|
939
979
|
function callDeepCopy(input) {
|
|
@@ -1442,4 +1482,4 @@ function incrementVersion(version, incrementType, options) {
|
|
|
1442
1482
|
var incrementVersion_default = incrementVersion;
|
|
1443
1483
|
|
|
1444
1484
|
//#endregion
|
|
1445
|
-
export { APIError_default as APIError, DataError_default as DataError, Env, NAMESPACE_EXPORT_REGEX_default as NAMESPACE_EXPORT_REGEX, VERSION_NUMBER_REGEX_default as VERSION_NUMBER_REGEX, VersionNumber_default as VersionNumber, VersionType, addDaysToDate_default as addDaysToDate, appendSemicolon_default as appendSemicolon, camelToKebab_default as camelToKebab, convertFileToBase64_default as convertFileToBase64, createFormData_default as createFormData, createTemplateStringsArray_default as createTemplateStringsArray, deepCopy_default as deepCopy, deepFreeze_default as deepFreeze, determineVersionType_default as determineVersionType, encryptWithKey_default as encryptWithKey, fillArray_default as fillArray, formatDateAndTime_default as formatDateAndTime, getIndividualVersionNumbers_default as getIndividualVersionNumbers, getInterpolations_default as getInterpolations, getRandomNumber_default as getRandomNumber, getRecordKeys_default as getRecordKeys, httpErrorCodeLookup, incrementVersion_default as incrementVersion, interpolate_default as interpolate, interpolateObjects_default as interpolateObjects, isAnniversary_default as isAnniversary, isLeapYear_default as isLeapYear, isMonthlyMultiple_default as isMonthlyMultiple, isOrdered_default as isOrdered, isSameDate_default as isSameDate, kebabToCamel_default as kebabToCamel, normaliseImportPath, normaliseIndents_default as normaliseIndents, normalizeImportPath_default as normalizeImportPath, normalizeIndents, omitProperties_default as omitProperties, paralleliseArrays_default as paralleliseArrays, parseBoolean_default as parseBoolean, parseEnv_default as parseEnv, parseFormData_default as parseFormData, parseIntStrict_default as parseIntStrict, parseVersion_default as parseVersion, parseVersionType_default as parseVersionType, parseZodSchema_default as parseZodSchema, randomiseArray_default as randomiseArray, range_default as range, removeDuplicates_default as removeDuplicates, stringListToArray_default as stringListToArray, stringifyDotenv_default as stringifyDotenv, truncate_default as truncate, wait_default as wait };
|
|
1485
|
+
export { APIError_default as APIError, DataError_default as DataError, Env, NAMESPACE_EXPORT_REGEX_default as NAMESPACE_EXPORT_REGEX, VERSION_NUMBER_REGEX_default as VERSION_NUMBER_REGEX, VersionNumber_default as VersionNumber, VersionType, addDaysToDate_default as addDaysToDate, appendSemicolon_default as appendSemicolon, camelToKebab_default as camelToKebab, convertFileToBase64_default as convertFileToBase64, createFormData_default as createFormData, createTemplateStringsArray_default as createTemplateStringsArray, deepCopy_default as deepCopy, deepFreeze_default as deepFreeze, determineVersionType_default as determineVersionType, encryptWithKey_default as encryptWithKey, fillArray_default as fillArray, formatDateAndTime_default as formatDateAndTime, getIndividualVersionNumbers_default as getIndividualVersionNumbers, getInterpolations_default as getInterpolations, getRandomNumber_default as getRandomNumber, getRecordKeys_default as getRecordKeys, httpErrorCodeLookup, incrementVersion_default as incrementVersion, interpolate_default as interpolate, interpolateObjects_default as interpolateObjects, isAnniversary_default as isAnniversary, isLeapYear_default as isLeapYear, isMonthlyMultiple_default as isMonthlyMultiple, isOrdered_default as isOrdered, isSameDate_default as isSameDate, kebabToCamel_default as kebabToCamel, normaliseImportPath, normaliseIndents_default as normaliseIndents, normalizeImportPath_default as normalizeImportPath, normalizeIndents, omitProperties_default as omitProperties, paralleliseArrays_default as paralleliseArrays, parseBoolean_default as parseBoolean, parseEnv_default as parseEnv, parseFormData_default as parseFormData, parseIntStrict_default as parseIntStrict, parseVersion_default as parseVersion, parseVersionType_default as parseVersionType, parseZodSchema_default as parseZodSchema, parseZodSchemaAsync_default as parseZodSchemaAsync, randomiseArray_default as randomiseArray, range_default as range, removeDuplicates_default as removeDuplicates, stringListToArray_default as stringListToArray, stringifyDotenv_default as stringifyDotenv, truncate_default as truncate, wait_default as wait };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alextheman/utility",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"description": "Helpful utility functions.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@types/libsodium-wrappers": "^0.7.14",
|
|
26
26
|
"@types/node": "^25.0.9",
|
|
27
27
|
"@typescript-eslint/types": "^8.53.0",
|
|
28
|
-
"alex-c-line": "^1.
|
|
28
|
+
"alex-c-line": "^1.18.4",
|
|
29
29
|
"dotenv-cli": "^11.0.0",
|
|
30
30
|
"eslint": "^9.39.2",
|
|
31
31
|
"globals": "^17.0.0",
|