@alextheman/utility 5.4.1 → 5.5.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 CHANGED
@@ -549,6 +549,21 @@ function addDaysToDate(currentDate = /* @__PURE__ */ new Date(), dayIncrement =
549
549
  return newDate;
550
550
  }
551
551
 
552
+ //#endregion
553
+ //#region src/root/functions/date/calculateMonthlyDifference.ts
554
+ /**
555
+ * Calculates the monthly difference between two given dates, subtracting the first from
556
+ * the second and gives a negative result if the first date occurs earlier than the second.
557
+ *
558
+ * @param firstDate - The first date
559
+ * @param secondDate - The second date
560
+ *
561
+ * @returns The calculated difference as a number
562
+ */
563
+ function calculateMonthlyDifference(firstDate, secondDate) {
564
+ return firstDate.getMonth() - secondDate.getMonth();
565
+ }
566
+
552
567
  //#endregion
553
568
  //#region src/root/functions/date/isSameDate.ts
554
569
  /**
@@ -1649,6 +1664,7 @@ exports.VersionNumber = VersionNumber;
1649
1664
  exports.VersionType = VersionType;
1650
1665
  exports.addDaysToDate = addDaysToDate;
1651
1666
  exports.appendSemicolon = appendSemicolon;
1667
+ exports.calculateMonthlyDifference = calculateMonthlyDifference;
1652
1668
  exports.camelToKebab = camelToKebab;
1653
1669
  exports.convertFileToBase64 = convertFileToBase64;
1654
1670
  exports.createFormData = createFormData;
package/dist/index.d.cts CHANGED
@@ -127,6 +127,18 @@ declare function removeDuplicates<ItemType>(array: ItemType[] | readonly ItemTyp
127
127
  */
128
128
  declare function addDaysToDate(currentDate?: Date, dayIncrement?: number): Date;
129
129
  //#endregion
130
+ //#region src/root/functions/date/calculateMonthlyDifference.d.ts
131
+ /**
132
+ * Calculates the monthly difference between two given dates, subtracting the first from
133
+ * the second and gives a negative result if the first date occurs earlier than the second.
134
+ *
135
+ * @param firstDate - The first date
136
+ * @param secondDate - The second date
137
+ *
138
+ * @returns The calculated difference as a number
139
+ */
140
+ declare function calculateMonthlyDifference(firstDate: Date, secondDate: Date): number;
141
+ //#endregion
130
142
  //#region src/root/functions/date/formatDateAndTime.d.ts
131
143
  /**
132
144
  * Creates a human-readable string with information about the input date.
@@ -1100,4 +1112,4 @@ declare function normaliseIndents(strings: TemplateStringsArray, ...interpolatio
1100
1112
  */
1101
1113
  declare const normalizeIndents: typeof normaliseIndents;
1102
1114
  //#endregion
1103
- export { APIError, ArrayElement, CallReturnType, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, IsTypeArgumentString, KebabToCamelOptions, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, ONE_DAY_IN_MILLISECONDS, OptionalOnCondition, ParallelTuple, RecordKey, RemoveUndefined, StringListToArrayOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
1115
+ export { APIError, ArrayElement, CallReturnType, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, IsTypeArgumentString, KebabToCamelOptions, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, ONE_DAY_IN_MILLISECONDS, OptionalOnCondition, ParallelTuple, RecordKey, RemoveUndefined, StringListToArrayOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
package/dist/index.d.ts CHANGED
@@ -127,6 +127,18 @@ declare function removeDuplicates<ItemType>(array: ItemType[] | readonly ItemTyp
127
127
  */
128
128
  declare function addDaysToDate(currentDate?: Date, dayIncrement?: number): Date;
129
129
  //#endregion
130
+ //#region src/root/functions/date/calculateMonthlyDifference.d.ts
131
+ /**
132
+ * Calculates the monthly difference between two given dates, subtracting the first from
133
+ * the second and gives a negative result if the first date occurs earlier than the second.
134
+ *
135
+ * @param firstDate - The first date
136
+ * @param secondDate - The second date
137
+ *
138
+ * @returns The calculated difference as a number
139
+ */
140
+ declare function calculateMonthlyDifference(firstDate: Date, secondDate: Date): number;
141
+ //#endregion
130
142
  //#region src/root/functions/date/formatDateAndTime.d.ts
131
143
  /**
132
144
  * Creates a human-readable string with information about the input date.
@@ -1100,4 +1112,4 @@ declare function normaliseIndents(strings: TemplateStringsArray, ...interpolatio
1100
1112
  */
1101
1113
  declare const normalizeIndents: typeof normaliseIndents;
1102
1114
  //#endregion
1103
- export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, KebabToCamelOptions, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, ParallelTuple, type RecordKey, type RemoveUndefined, type StringListToArrayOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
1115
+ export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, KebabToCamelOptions, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, ParallelTuple, type RecordKey, type RemoveUndefined, type StringListToArrayOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
package/dist/index.js CHANGED
@@ -519,6 +519,21 @@ function addDaysToDate(currentDate = /* @__PURE__ */ new Date(), dayIncrement =
519
519
  return newDate;
520
520
  }
521
521
 
522
+ //#endregion
523
+ //#region src/root/functions/date/calculateMonthlyDifference.ts
524
+ /**
525
+ * Calculates the monthly difference between two given dates, subtracting the first from
526
+ * the second and gives a negative result if the first date occurs earlier than the second.
527
+ *
528
+ * @param firstDate - The first date
529
+ * @param secondDate - The second date
530
+ *
531
+ * @returns The calculated difference as a number
532
+ */
533
+ function calculateMonthlyDifference(firstDate, secondDate) {
534
+ return firstDate.getMonth() - secondDate.getMonth();
535
+ }
536
+
522
537
  //#endregion
523
538
  //#region src/root/functions/date/isSameDate.ts
524
539
  /**
@@ -1605,4 +1620,4 @@ function truncate(stringToTruncate, maxLength = 5) {
1605
1620
  }
1606
1621
 
1607
1622
  //#endregion
1608
- export { APIError, DataError, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, ONE_DAY_IN_MILLISECONDS, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
1623
+ export { APIError, DataError, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, ONE_DAY_IN_MILLISECONDS, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, VersionType, addDaysToDate, appendSemicolon, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/utility",
3
- "version": "5.4.1",
3
+ "version": "5.5.0",
4
4
  "description": "Helpful utility functions.",
5
5
  "repository": {
6
6
  "type": "git",