@dereekb/util 11.1.4 → 11.1.6

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util/fetch",
3
- "version": "11.1.4",
3
+ "version": "11.1.6",
4
4
  ".": {
5
5
  "types": "./src/index.d.ts",
6
6
  "node": {
package/index.cjs.js CHANGED
@@ -9770,6 +9770,9 @@ function isEqualDate(a, b) {
9770
9770
  function isPast(input) {
9771
9771
  return input.getTime() < Date.now();
9772
9772
  }
9773
+ function addMilliseconds(input, ms) {
9774
+ return input != null ? new Date(input.getTime() + (ms != null ? ms : 0)) : input;
9775
+ }
9773
9776
 
9774
9777
  const FRACTIONAL_HOURS_PRECISION_FUNCTION = cutValueToPrecisionFunction(3);
9775
9778
  /**
@@ -12983,6 +12986,167 @@ function objectIsEmpty(obj) {
12983
12986
  return true;
12984
12987
  }
12985
12988
 
12989
+ /**
12990
+ * Converts a Date object or unix timestamp number to a unix timestamp number.
12991
+ *
12992
+ * @param input - Date object or unix timestamp number to convert
12993
+ * @returns Unix timestamp number if input is valid, null/undefined if input is null/undefined
12994
+ */
12995
+ function unixTimeNumberFromDateOrTimeNumber(input) {
12996
+ if (input == null) {
12997
+ return input;
12998
+ } else if (isDate(input)) {
12999
+ return unixTimeNumberFromDate(input);
13000
+ } else {
13001
+ return input;
13002
+ }
13003
+ }
13004
+ /**
13005
+ * Gets the current time as a unix timestamp number.
13006
+ *
13007
+ * @returns Current time as unix timestamp number
13008
+ */
13009
+ function unixTimeNumberForNow() {
13010
+ return unixTimeNumberFromDate(new Date());
13011
+ }
13012
+ function unixTimeNumberFromDate(date) {
13013
+ return date != null ? Math.ceil(date.getTime() / 1000) : date;
13014
+ }
13015
+ /**
13016
+ * Converts a Date object or unix timestamp number to a Date object.
13017
+ *
13018
+ * @param input - Date object or unix timestamp number to convert
13019
+ * @returns Date object if input is valid, null/undefined if input is null/undefined
13020
+ */
13021
+ function dateFromDateOrTimeNumber(input) {
13022
+ if (input == null) {
13023
+ return input;
13024
+ } else if (isDate(input)) {
13025
+ return input;
13026
+ } else {
13027
+ return unixTimeNumberToDate(input);
13028
+ }
13029
+ }
13030
+ /**
13031
+ * Converts a unix timestamp number to a Date object.
13032
+ *
13033
+ * @param dateTimeNumber - Unix timestamp number to convert
13034
+ * @returns Date object if timestamp is valid, null/undefined if timestamp is null/undefined
13035
+ */
13036
+ function unixTimeNumberToDate(dateTimeNumber) {
13037
+ return dateTimeNumber != null ? new Date(dateTimeNumber * 1000) : dateTimeNumber;
13038
+ }
13039
+
13040
+ /**
13041
+ * Returns expiration details for the input.
13042
+ *
13043
+ * @param input
13044
+ * @returns
13045
+ */
13046
+ function expirationDetails(input) {
13047
+ const {
13048
+ expiresAt,
13049
+ expires,
13050
+ now: inputNow,
13051
+ expiresFromDate,
13052
+ defaultExpiresFromDateToNow,
13053
+ expiresIn
13054
+ } = input;
13055
+ const parsedExpiresFromDate = expiresFromDate != null ? dateFromDateOrTimeNumber(expiresFromDate) : null;
13056
+ function getNow(nowOverride) {
13057
+ var _ref;
13058
+ const now = (_ref = nowOverride != null ? nowOverride : inputNow) != null ? _ref : new Date();
13059
+ return now;
13060
+ }
13061
+ function hasExpired(nowOverride, defaultIfNoExpirationDate = false) {
13062
+ const now = getNow(nowOverride);
13063
+ const expirationDate = getExpirationDateForNow(now);
13064
+ let result;
13065
+ if (expirationDate == null) {
13066
+ result = defaultIfNoExpirationDate;
13067
+ } else {
13068
+ result = expirationDate <= now;
13069
+ }
13070
+ return result;
13071
+ }
13072
+ function getExpirationDate(nowOverride) {
13073
+ const now = getNow(nowOverride);
13074
+ return getExpirationDateForNow(now);
13075
+ }
13076
+ function getExpirationDateForNow(now) {
13077
+ let expirationDate = null;
13078
+ if ((expires == null ? void 0 : expires.expiresAt) != null) {
13079
+ expirationDate = expires.expiresAt;
13080
+ } else if (expiresAt != null) {
13081
+ expirationDate = expiresAt;
13082
+ } else if (expiresIn != null) {
13083
+ const date = parsedExpiresFromDate != null ? parsedExpiresFromDate : defaultExpiresFromDateToNow !== false ? now : null;
13084
+ expirationDate = addMilliseconds(date, expiresIn);
13085
+ }
13086
+ return expirationDate;
13087
+ }
13088
+ return {
13089
+ input,
13090
+ hasExpired,
13091
+ getExpirationDate
13092
+ };
13093
+ }
13094
+ // MARK: Utility
13095
+ /**
13096
+ * Convenience function for calculating and returning the expiration date given the input.
13097
+ *
13098
+ * @param input Input used to calculate the expiration date.
13099
+ * @returns The expiration date, if applicable.
13100
+ */
13101
+ function calculateExpirationDate(input) {
13102
+ return expirationDetails(input).getExpirationDate();
13103
+ }
13104
+ /**
13105
+ * Convenience function for quickly calculating throttling given a throttle time and last run time.
13106
+ *
13107
+ * Returns true if the throttle time has not passed since the last run time, compared to now.
13108
+
13109
+ * @param throttleTime Time after "now" that expiration will occur.
13110
+ * @param lastRunAt Time the last run occurred.
13111
+ * @param now Optional override for the current time. Defaults to the current time.
13112
+ * @returns
13113
+ */
13114
+ function isThrottled(throttleTime, lastRunAt, now) {
13115
+ return !expirationDetails({
13116
+ defaultExpiresFromDateToNow: false,
13117
+ expiresFromDate: lastRunAt != null ? lastRunAt : null,
13118
+ expiresIn: throttleTime
13119
+ }).hasExpired(now, true);
13120
+ }
13121
+ /**
13122
+ * Returns true if any of the input ExpirationDetails have not expired.
13123
+ *
13124
+ * If the list is empty, returns false.
13125
+ *
13126
+ * @param details List of ExpirationDetails to check.
13127
+ * @returns True if any of the input ExpirationDetails have not expired.
13128
+ */
13129
+ function checkAtleastOneNotExpired(details) {
13130
+ const firstExpired = details.findIndex(detail => !detail.hasExpired());
13131
+ return firstExpired !== -1;
13132
+ }
13133
+ /**
13134
+ * Returns true if any of the input ExpirationDetails have expired.
13135
+ *
13136
+ * If the list is empty, returns the value of the second argument.
13137
+ *
13138
+ * @param details List of ExpirationDetails to check.
13139
+ * @param defaultIfEmpty Default value to return if the list is empty. True by default.
13140
+ * @returns True if any of the input ExpirationDetails have expired.
13141
+ */
13142
+ function checkAnyHaveExpired(details, defaultIfEmpty = true) {
13143
+ if (details.length === 0) {
13144
+ return defaultIfEmpty;
13145
+ }
13146
+ const firstExpired = details.findIndex(detail => detail.hasExpired());
13147
+ return firstExpired !== -1;
13148
+ }
13149
+
12986
13150
  /**
12987
13151
  * Returns the day of the week for the input day.
12988
13152
  *
@@ -16385,6 +16549,7 @@ exports.WEB_PROTOCOL_PREFIX_REGEX = WEB_PROTOCOL_PREFIX_REGEX;
16385
16549
  exports.ZIP_CODE_STRING_REGEX = ZIP_CODE_STRING_REGEX;
16386
16550
  exports.addHttpToUrl = addHttpToUrl;
16387
16551
  exports.addLatLngPoints = addLatLngPoints;
16552
+ exports.addMilliseconds = addMilliseconds;
16388
16553
  exports.addModifiers = addModifiers;
16389
16554
  exports.addPlusPrefixToNumber = addPlusPrefixToNumber;
16390
16555
  exports.addPrefix = addPrefix;
@@ -16450,6 +16615,7 @@ exports.boundNumberFunction = boundNumberFunction;
16450
16615
  exports.boundToRectangle = boundToRectangle;
16451
16616
  exports.build = build;
16452
16617
  exports.cachedGetter = cachedGetter;
16618
+ exports.calculateExpirationDate = calculateExpirationDate;
16453
16619
  exports.capLatValue = capLatValue;
16454
16620
  exports.capitalizeFirstLetter = capitalizeFirstLetter;
16455
16621
  exports.caseInsensitiveFilterByIndexOfDecisionFactory = caseInsensitiveFilterByIndexOfDecisionFactory;
@@ -16457,6 +16623,8 @@ exports.caseInsensitiveString = caseInsensitiveString;
16457
16623
  exports.catchAllHandlerKey = catchAllHandlerKey;
16458
16624
  exports.chainMapFunction = chainMapFunction;
16459
16625
  exports.chainMapSameFunctions = chainMapSameFunctions;
16626
+ exports.checkAnyHaveExpired = checkAnyHaveExpired;
16627
+ exports.checkAtleastOneNotExpired = checkAtleastOneNotExpired;
16460
16628
  exports.coerceToEmailParticipants = coerceToEmailParticipants;
16461
16629
  exports.combineMaps = combineMaps;
16462
16630
  exports.compareEqualityWithValueFromItemsFunction = compareEqualityWithValueFromItemsFunction;
@@ -16497,6 +16665,7 @@ exports.cutToPrecision = cutToPrecision;
16497
16665
  exports.cutValueToInteger = cutValueToInteger;
16498
16666
  exports.cutValueToPrecision = cutValueToPrecision;
16499
16667
  exports.cutValueToPrecisionFunction = cutValueToPrecisionFunction;
16668
+ exports.dateFromDateOrTimeNumber = dateFromDateOrTimeNumber;
16500
16669
  exports.dateFromLogicalDate = dateFromLogicalDate;
16501
16670
  exports.dateFromMinuteOfDay = dateFromMinuteOfDay;
16502
16671
  exports.dateToHoursAndMinutes = dateToHoursAndMinutes;
@@ -16537,6 +16706,7 @@ exports.expandFlattenTreeFunction = expandFlattenTreeFunction;
16537
16706
  exports.expandIndexSet = expandIndexSet;
16538
16707
  exports.expandTreeFunction = expandTreeFunction;
16539
16708
  exports.expandTrees = expandTrees;
16709
+ exports.expirationDetails = expirationDetails;
16540
16710
  exports.exponentialPromiseRateLimiter = exponentialPromiseRateLimiter;
16541
16711
  exports.extendLatLngBound = extendLatLngBound;
16542
16712
  exports.filterAndMapFunction = filterAndMapFunction;
@@ -16727,6 +16897,7 @@ exports.isSlashPathFolder = isSlashPathFolder;
16727
16897
  exports.isSlashPathTypedFile = isSlashPathTypedFile;
16728
16898
  exports.isStandardInternetAccessibleWebsiteUrl = isStandardInternetAccessibleWebsiteUrl;
16729
16899
  exports.isStringOrTrue = isStringOrTrue;
16900
+ exports.isThrottled = isThrottled;
16730
16901
  exports.isTrueBooleanKeyArray = isTrueBooleanKeyArray;
16731
16902
  exports.isUTCDateString = isUTCDateString;
16732
16903
  exports.isUniqueKeyedFunction = isUniqueKeyedFunction;
@@ -17091,6 +17262,10 @@ exports.uniqueCaseInsensitiveStringsSet = uniqueCaseInsensitiveStringsSet;
17091
17262
  exports.uniqueKeys = uniqueKeys;
17092
17263
  exports.uniqueModels = uniqueModels;
17093
17264
  exports.unitedStatesAddressString = unitedStatesAddressString;
17265
+ exports.unixTimeNumberForNow = unixTimeNumberForNow;
17266
+ exports.unixTimeNumberFromDate = unixTimeNumberFromDate;
17267
+ exports.unixTimeNumberFromDateOrTimeNumber = unixTimeNumberFromDateOrTimeNumber;
17268
+ exports.unixTimeNumberToDate = unixTimeNumberToDate;
17094
17269
  exports.updateMaybeValue = updateMaybeValue;
17095
17270
  exports.urlWithoutParameters = urlWithoutParameters;
17096
17271
  exports.useAsync = useAsync;
package/index.esm.js CHANGED
@@ -11387,6 +11387,19 @@ function isPast(input) {
11387
11387
  return input.getTime() < Date.now();
11388
11388
  }
11389
11389
 
11390
+ /**
11391
+ * Adds milliseconds to the input date.
11392
+ *
11393
+ * If no date is input, then returns the input.
11394
+ *
11395
+ * @param input
11396
+ * @param ms
11397
+ */
11398
+
11399
+ function addMilliseconds(input, ms) {
11400
+ return input != null ? new Date(input.getTime() + (ms != null ? ms : 0)) : input;
11401
+ }
11402
+
11390
11403
  /**
11391
11404
  * A number that represents hours and rounded to the nearest minute.
11392
11405
  *
@@ -14705,6 +14718,197 @@ function objectIsEmpty(obj) {
14705
14718
  return true;
14706
14719
  }
14707
14720
 
14721
+ /**
14722
+ * Converts a Date object or unix timestamp number to a unix timestamp number.
14723
+ *
14724
+ * @param input - Date object or unix timestamp number to convert
14725
+ * @returns Unix timestamp number if input is valid, null/undefined if input is null/undefined
14726
+ */
14727
+ function unixTimeNumberFromDateOrTimeNumber(input) {
14728
+ if (input == null) {
14729
+ return input;
14730
+ } else if (isDate(input)) {
14731
+ return unixTimeNumberFromDate(input);
14732
+ } else {
14733
+ return input;
14734
+ }
14735
+ }
14736
+
14737
+ /**
14738
+ * Gets the current time as a unix timestamp number.
14739
+ *
14740
+ * @returns Current time as unix timestamp number
14741
+ */
14742
+ function unixTimeNumberForNow() {
14743
+ return unixTimeNumberFromDate(new Date());
14744
+ }
14745
+
14746
+ /**
14747
+ * Converts a Date object to a unix timestamp number.
14748
+ *
14749
+ * @param date - Date object to convert
14750
+ * @returns Unix timestamp number if date is valid, null/undefined if date is null/undefined
14751
+ */
14752
+
14753
+ function unixTimeNumberFromDate(date) {
14754
+ return date != null ? Math.ceil(date.getTime() / 1000) : date;
14755
+ }
14756
+
14757
+ /**
14758
+ * Converts a Date object or unix timestamp number to a Date object.
14759
+ *
14760
+ * @param input - Date object or unix timestamp number to convert
14761
+ * @returns Date object if input is valid, null/undefined if input is null/undefined
14762
+ */
14763
+ function dateFromDateOrTimeNumber(input) {
14764
+ if (input == null) {
14765
+ return input;
14766
+ } else if (isDate(input)) {
14767
+ return input;
14768
+ } else {
14769
+ return unixTimeNumberToDate(input);
14770
+ }
14771
+ }
14772
+
14773
+ /**
14774
+ * Converts a unix timestamp number to a Date object.
14775
+ *
14776
+ * @param dateTimeNumber - Unix timestamp number to convert
14777
+ * @returns Date object if timestamp is valid, null/undefined if timestamp is null/undefined
14778
+ */
14779
+ function unixTimeNumberToDate(dateTimeNumber) {
14780
+ return dateTimeNumber != null ? new Date(dateTimeNumber * 1000) : dateTimeNumber;
14781
+ }
14782
+
14783
+ // MARK: Expires
14784
+ /**
14785
+ * An object that can expire.
14786
+ */
14787
+
14788
+ // MARK: Expiration Details
14789
+ /**
14790
+ * expirationDetails() input.
14791
+ *
14792
+ * The priority that the expiration calculation uses takes the following order:
14793
+ * 1. expires
14794
+ * 2. expiresAt
14795
+ * 3. date + expiresIn
14796
+ */
14797
+
14798
+ /**
14799
+ * Returns expiration details for the input.
14800
+ *
14801
+ * @param input
14802
+ * @returns
14803
+ */
14804
+ function expirationDetails(input) {
14805
+ const {
14806
+ expiresAt,
14807
+ expires,
14808
+ now: inputNow,
14809
+ expiresFromDate,
14810
+ defaultExpiresFromDateToNow,
14811
+ expiresIn
14812
+ } = input;
14813
+ const parsedExpiresFromDate = expiresFromDate != null ? dateFromDateOrTimeNumber(expiresFromDate) : null;
14814
+ function getNow(nowOverride) {
14815
+ var _ref;
14816
+ const now = (_ref = nowOverride != null ? nowOverride : inputNow) != null ? _ref : new Date();
14817
+ return now;
14818
+ }
14819
+ function hasExpired(nowOverride, defaultIfNoExpirationDate = false) {
14820
+ const now = getNow(nowOverride);
14821
+ const expirationDate = getExpirationDateForNow(now);
14822
+ let result;
14823
+ if (expirationDate == null) {
14824
+ result = defaultIfNoExpirationDate;
14825
+ } else {
14826
+ result = expirationDate <= now;
14827
+ }
14828
+ return result;
14829
+ }
14830
+ function getExpirationDate(nowOverride) {
14831
+ const now = getNow(nowOverride);
14832
+ return getExpirationDateForNow(now);
14833
+ }
14834
+ function getExpirationDateForNow(now) {
14835
+ let expirationDate = null;
14836
+ if ((expires == null ? void 0 : expires.expiresAt) != null) {
14837
+ expirationDate = expires.expiresAt;
14838
+ } else if (expiresAt != null) {
14839
+ expirationDate = expiresAt;
14840
+ } else if (expiresIn != null) {
14841
+ const date = parsedExpiresFromDate != null ? parsedExpiresFromDate : defaultExpiresFromDateToNow !== false ? now : null;
14842
+ expirationDate = addMilliseconds(date, expiresIn);
14843
+ }
14844
+ return expirationDate;
14845
+ }
14846
+ return {
14847
+ input,
14848
+ hasExpired,
14849
+ getExpirationDate
14850
+ };
14851
+ }
14852
+
14853
+ // MARK: Utility
14854
+ /**
14855
+ * Convenience function for calculating and returning the expiration date given the input.
14856
+ *
14857
+ * @param input Input used to calculate the expiration date.
14858
+ * @returns The expiration date, if applicable.
14859
+ */
14860
+ function calculateExpirationDate(input) {
14861
+ return expirationDetails(input).getExpirationDate();
14862
+ }
14863
+
14864
+ /**
14865
+ * Convenience function for quickly calculating throttling given a throttle time and last run time.
14866
+ *
14867
+ * Returns true if the throttle time has not passed since the last run time, compared to now.
14868
+
14869
+ * @param throttleTime Time after "now" that expiration will occur.
14870
+ * @param lastRunAt Time the last run occurred.
14871
+ * @param now Optional override for the current time. Defaults to the current time.
14872
+ * @returns
14873
+ */
14874
+ function isThrottled(throttleTime, lastRunAt, now) {
14875
+ return !expirationDetails({
14876
+ defaultExpiresFromDateToNow: false,
14877
+ expiresFromDate: lastRunAt != null ? lastRunAt : null,
14878
+ expiresIn: throttleTime
14879
+ }).hasExpired(now, true);
14880
+ }
14881
+
14882
+ /**
14883
+ * Returns true if any of the input ExpirationDetails have not expired.
14884
+ *
14885
+ * If the list is empty, returns false.
14886
+ *
14887
+ * @param details List of ExpirationDetails to check.
14888
+ * @returns True if any of the input ExpirationDetails have not expired.
14889
+ */
14890
+ function checkAtleastOneNotExpired(details) {
14891
+ const firstExpired = details.findIndex(detail => !detail.hasExpired());
14892
+ return firstExpired !== -1;
14893
+ }
14894
+
14895
+ /**
14896
+ * Returns true if any of the input ExpirationDetails have expired.
14897
+ *
14898
+ * If the list is empty, returns the value of the second argument.
14899
+ *
14900
+ * @param details List of ExpirationDetails to check.
14901
+ * @param defaultIfEmpty Default value to return if the list is empty. True by default.
14902
+ * @returns True if any of the input ExpirationDetails have expired.
14903
+ */
14904
+ function checkAnyHaveExpired(details, defaultIfEmpty = true) {
14905
+ if (details.length === 0) {
14906
+ return defaultIfEmpty;
14907
+ }
14908
+ const firstExpired = details.findIndex(detail => detail.hasExpired());
14909
+ return firstExpired !== -1;
14910
+ }
14911
+
14708
14912
  /**
14709
14913
  * Values that correspond to each day of the week.
14710
14914
  */
@@ -17579,4 +17783,4 @@ async function iterateFilteredPages(inputPage, loadFn, iterFn) {
17579
17783
  return count;
17580
17784
  }
17581
17785
 
17582
- export { ALL_DOUBLE_SLASHES_REGEX, ALL_SLASHES_REGEX, ALL_SLASH_PATH_FILE_TYPE_SEPARATORS_REGEX, ASSERTION_ERROR_CODE, ASSERTION_HANDLER, AUTH_ADMIN_ROLE, AUTH_ONBOARDED_ROLE, AUTH_ROLE_CLAIMS_DEFAULT_CLAIM_VALUE, AUTH_ROLE_CLAIMS_DEFAULT_EMPTY_VALUE, AUTH_TOS_SIGNED_ROLE, AUTH_USER_ROLE, AbstractUniqueModel, Assert, AssertMax, AssertMin, AssertionError, AssertionIssueHandler, BooleanStringKeyArrayUtility, BooleanStringKeyArrayUtilityInstance, CATCH_ALL_HANDLE_RESULT_KEY, CUT_VALUE_TO_ZERO_PRECISION, DATE_NOW_VALUE, DEFAULT_CUT_STRING_END_TEXT, DEFAULT_LAT_LNG_STRING_VALUE, DEFAULT_RANDOM_EMAIL_FACTORY_CONFIG, DEFAULT_RANDOM_PHONE_NUMBER_FACTORY_CONFIG, DEFAULT_READABLE_ERROR_CODE, DEFAULT_SLASH_PATH_ILLEGAL_CHARACTERS, DEFAULT_SLASH_PATH_ILLEGAL_CHARACTER_REPLACEMENT, DEFAULT_UNKNOWN_MODEL_TYPE_STRING, DOLLAR_AMOUNT_PRECISION, DOLLAR_AMOUNT_STRING_REGEX, DataDoesNotExistError, DataIsExpiredError, Day, DestroyFunctionObject, E164PHONE_NUMBER_REGEX, E164PHONE_NUMBER_WITH_EXTENSION_REGEX, E164PHONE_NUMBER_WITH_OPTIONAL_EXTENSION_REGEX, FINAL_PAGE, FIRST_PAGE, FRACTIONAL_HOURS_PRECISION_FUNCTION, FullStorageObject, HAS_PORT_NUMBER_REGEX, HAS_WEBSITE_DOMAIN_NAME_REGEX, HOURS_IN_DAY, HTTP_OR_HTTPS_REGEX, HashSet, ISO8601_DAY_STRING_REGEX, ISO8601_DAY_STRING_START_REGEX, ISO_8601_DATE_STRING_REGEX, KeyValueTypleValueFilter, LAT_LNG_PATTERN, LAT_LNG_PATTERN_MAX_PRECISION, LAT_LONG_100KM_PRECISION, LAT_LONG_100M_PRECISION, LAT_LONG_10CM_PRECISION, LAT_LONG_10KM_PRECISION, LAT_LONG_10M_PRECISION, LAT_LONG_1CM_PRECISION, LAT_LONG_1KM_PRECISION, LAT_LONG_1MM_PRECISION, LAT_LONG_1M_PRECISION, LAT_LONG_GRAINS_OF_SAND_PRECISION, LEADING_SLASHES_REGEX, MAP_IDENTITY, MAX_BITWISE_SET_SIZE, MAX_LATITUDE_VALUE, MAX_LONGITUDE_VALUE, MINUTES_IN_DAY, MINUTES_IN_HOUR, MINUTE_OF_DAY_MAXMIMUM, MINUTE_OF_DAY_MINIUMUM, MIN_LATITUDE_VALUE, MIN_LONGITUDE_VALUE, MONTH_DAY_SLASH_DATE_STRING_REGEX, MS_IN_DAY, MS_IN_HOUR, MS_IN_MINUTE, MS_IN_SECOND, MemoryStorageInstance, ModelRelationUtility, NOOP_MODIFIER, NUMBER_STRING_DENCODER_64, NUMBER_STRING_DENCODER_64_DEFAULT_NEGATIVE_PREFIX, NUMBER_STRING_DENCODER_64_DIGITS, PHONE_EXTENSION_NUMBER_REGEX, PRIMATIVE_KEY_DENCODER_VALUE, PageCalculator, PropertyDescriptorUtility, REGEX_SPECIAL_CHARACTERS, REGEX_SPECIAL_CHARACTERS_SET, RelationChange, SECONDS_IN_MINUTE, SHARED_MEMORY_STORAGE, SLASH_PATH_FILE_TYPE_SEPARATOR, SLASH_PATH_SEPARATOR, SORT_VALUE_EQUAL, SORT_VALUE_GREATER_THAN, SORT_VALUE_LESS_THAN, SPLIT_STRING_TREE_NODE_ROOT_VALUE, ServerErrorResponse, SetDeltaChange, SimpleStorageObject, StorageObject, StorageObjectUtility, StoredDataError, SyncState, TOTAL_LATITUDE_RANGE, TOTAL_LONGITUDE_RANGE, TOTAL_SPAN_OF_LONGITUDE, TRAILING_FILE_TYPE_SEPARATORS_REGEX, TRAILING_SLASHES_REGEX, TimeAM, TimerCancelledError, TimerInstance, TypedServiceRegistryInstance, UNLOADED_PAGE, UNSET_INDEX_NUMBER, US_STATE_CODE_STRING_REGEX, UTC_DATE_STRING_REGEX, UTC_TIMEZONE_STRING, UTF_8_START_CHARACTER, UTF_PRIVATE_USAGE_AREA_START, UnauthorizedServerErrorResponse, WEBSITE_TLD_DETECTION_REGEX, WEB_PROTOCOL_PREFIX_REGEX, ZIP_CODE_STRING_REGEX, addHttpToUrl, addLatLngPoints, addModifiers, addPlusPrefixToNumber, addPrefix, addPrefixFunction, addSuffix, addSuffixFunction, addToSet, addToSetCopy, addToSplitStringTree, allFalsyOrEmptyKeys, allIndexesInIndexRange, allKeyValueTuples, allMaybeSoKeys, allNonUndefinedKeys, allObjectsAreEqual, allValuesAreMaybeNot, allValuesAreNotMaybe, allowValueOnceFilter, applyBestFit, applySplitStringTreeWithMultipleValues, applyToMultipleFields, approximateTimerEndDate, areEqualContext, areEqualPOJOValues, areEqualPOJOValuesUsingPojoFilter, arrayContainsDuplicateValue, arrayContentsDiffer, arrayDecision, arrayDecisionFunction, arrayFactory, arrayInputFactory, arrayToLowercase, arrayToMap, arrayToObject, arrayToUppercase, asArray, asDecisionFunction, asGetter, asIndexRangeCheckFunctionConfig, asIterable, asMinuteOfDay, asNumber, asObjectCopyFactory, asPromise, asSet, assignValuesToPOJO, assignValuesToPOJOFunction, authClaims, authRoleClaimsService, authRolesSetHasRoles, baseWebsiteUrl, batch, batchCalc, bitwiseObjectDencoder, bitwiseObjectEncoder, bitwiseObjectdecoder, bitwiseSetDecoder, bitwiseSetDencoder, booleanFactory, booleanKeyArrayUtility, boundNumber, boundNumberFunction, boundToRectangle, build, cachedGetter, capLatValue, capitalizeFirstLetter, caseInsensitiveFilterByIndexOfDecisionFactory, caseInsensitiveString, catchAllHandlerKey, chainMapFunction, chainMapSameFunctions, coerceToEmailParticipants, combineMaps, compareEqualityWithValueFromItemsFunction, compareEqualityWithValueFromItemsFunctionFactory, compareFnOrder, compareWithMappedValuesFunction, computeNextFractionalHour, computeNextFreeIndexFunction, computeNextFreeIndexOnSortedValuesFunction, concatArrays, concatArraysUnique, containsAllStringsAnyCase, containsAllValues, containsAnyStringAnyCase, containsAnyValue, containsAnyValueFromSet, containsNoValueFromSet, containsNoneOfValue, containsStringAnyCase, convertEmailParticipantStringToParticipant, convertMaybeToArray, convertParticipantToEmailParticipantString, convertToArray, copyArray, copyField, copyLatLngBound, copyLatLngPoint, copyObject, copySetAndDo, countAllInNestedArray, countPOJOKeys, countPOJOKeysFunction, cronExpressionRepeatingEveryNMinutes, cssClassesSet, cutString, cutStringFunction, cutToPrecision, cutValueToInteger, cutValueToPrecision, cutValueToPrecisionFunction, dateFromLogicalDate, dateFromMinuteOfDay, dateToHoursAndMinutes, dateToMinuteOfDay, dayOfWeek, daysOfWeekArray, daysOfWeekFromEnabledDays, daysOfWeekNameFunction, daysOfWeekNameMap, decisionFunction, decodeHashedValues, decodeHashedValuesWithDecodeMap, decodeModelKeyTypePair, defaultFilterFromPOJOFunctionNoCopy, defaultForwardFunctionFactory, defaultLatLngPoint, defaultLatLngString, dencodeBitwiseSet, diffLatLngBoundPoints, diffLatLngPoints, dollarAmountString, e164PhoneNumberExtensionPair, e164PhoneNumberFromE164PhoneNumberExtensionPair, enabledDaysFromDaysOfWeek, encodeBitwiseSet, encodeModelKeyTypePair, errorMessageContainsString, errorMessageContainsStringFunction, escapeStringCharactersFunction, escapeStringForRegex, excludeValues, excludeValuesFromArray, excludeValuesFromSet, existsInIterable, expandArrayMapTuples, expandArrayValueTuples, expandFlattenTreeFunction, expandIndexSet, expandTreeFunction, expandTrees, exponentialPromiseRateLimiter, extendLatLngBound, filterAndMapFunction, filterEmptyArrayValues, filterEmptyValues, filterFalsyAndEmptyValues, filterFromIterable, filterFromPOJO, filterFromPOJOFunction, filterKeyValueTupleFunction, filterKeyValueTuples, filterKeyValueTuplesFunction, filterKeyValueTuplesInputToFilter, filterKeysOnPOJOFunction, filterMaybeArrayFunction, filterMaybeArrayValues, filterMaybeValues, filterNullAndUndefinedValues, filterOnlyUndefinedValues, filterTuplesOnPOJOFunction, filterUndefinedValues, filterUniqueByIndex, filterUniqueCaseInsensitiveStrings, filterUniqueFunction, filterUniqueTransform, filterUniqueValues, filterValuesByDistance, filterValuesByDistanceNoOrder, filterValuesToSet, filterValuesUsingSet, filteredPage, findAllCharacterOccurences, findAllCharacterOccurencesFunction, findBest, findBestIndexMatch, findBestIndexMatchFunction, findBestIndexSetPair, findBestSplitStringTreeChildMatch, findBestSplitStringTreeChildMatchPath, findBestSplitStringTreeMatch, findBestSplitStringTreeMatchPath, findFirstCharacterOccurence, findInIterable, findIndexOfFirstDuplicateValue, findItemsByIndex, findNext, findPOJOKeys, findPOJOKeysFunction, findStringsRegexString, findToIndexSet, findValuesFrom, firstAndLastCharacterOccurrence, firstAndLastValue, firstValue, firstValueFromIterable, fitToIndexRangeFunction, fixExtraQueryParameters, fixMultiSlashesInSlashPath, flattenArray, flattenArrayOrValueArray, flattenArrayToSet, flattenArrayUnique, flattenArrayUniqueCaseInsensitiveStrings, flattenTree, flattenTreeToArray, flattenTreeToArrayFunction, flattenTrees, forEachInIterable, forEachKeyValue, forEachKeyValueOnPOJOFunction, forEachWithArray, forwardFunction, fractionalHoursToMinutes, generateIfDoesNotExist, getArrayNextIndex, getBaseLog, getDayOffset, getDayTomorrow, getDayYesterday, getDaysOfWeekNames, getFunctionType, getNextDay, getNextPageNumber, getOverlappingRectangle, getPageNumber, getPreviousDay, getValueFromGetter, groupValues, handlerBindAccessor, handlerConfigurerFactory, handlerFactory, handlerMappedSetFunction, handlerMappedSetFunctionFactory, handlerSetFunction, hasDifferentStringsNoCase, hasDifferentValues, hasHttpPrefix, hasNonNullValue, hasPortNumber, hasSameTimezone, hasSameValues, hasValueFunction, hasValueOrNotEmpty, hasValueOrNotEmptyObject, hasWebsiteDomain, hasWebsiteTopLevelDomain, hashSetForIndexed, hourToFractionalHour, idBatchFactory, incrementingNumberFactory, indexDeltaGroup, indexDeltaGroupFunction, indexRange, indexRangeCheckFunction, indexRangeCheckReaderFunction, indexRangeForArray, indexRangeOverlapsIndexRange, indexRangeOverlapsIndexRangeFunction, indexRangeReaderPairFactory, indexRefMap, indexedValuesArrayAccessorFactory, insertIntoBooleanKeyArray, invertBooleanReturnFunction, invertDecision, invertFilter, isAllowed, isClassLikeType, isCompleteUnitedStatesAddress, isConsideredUtcTimezoneString, isDate, isDefaultLatLngPoint, isDefaultLatLngPointValue, isDefaultReadableError, isDefinedAndNotFalse, isDollarAmountString, isE164PhoneNumber, isE164PhoneNumberWithExtension, isEmptyIterable, isEqualContext, isEqualDate, isEqualToValueDecisionFunction, isEvenNumber, isFalseBooleanKeyArray, isFinalPage, isGetter, isISO8601DateString, isISO8601DayString, isISO8601DayStringStart, isInAllowedDaysOfWeekSet, isInNumberBoundFunction, isInSetDecisionFunction, isIndexNumberInIndexRange, isIndexNumberInIndexRangeFunction, isIndexRangeInIndexRange, isIndexRangeInIndexRangeFunction, isIterable, isKnownHttpWebsiteProtocol, isLatLngBound, isLatLngBoundWithinLatLngBound, isLatLngPoint, isLatLngPointWithinLatLngBound, isLatLngString, isLogicalDateStringCode, isMapIdentityFunction, isMaybeNot, isMaybeNotOrTrue, isMaybeSo, isMinuteOfDay, isModelKey, isMonthDaySlashDate, isNonClassFunction, isNotNullOrEmptyString, isNumberDivisibleBy, isObjectWithConstructor, isOddNumber, isPast, isPromise, isPromiseLike, isSameLatLngBound, isSameLatLngPoint, isSameNonNullValue, isSameVector, isSelectedDecisionFunctionFactory, isSelectedIndexDecisionFunction, isServerError, isSlashPathFile, isSlashPathFolder, isSlashPathTypedFile, isStandardInternetAccessibleWebsiteUrl, isStringOrTrue, isTrueBooleanKeyArray, isUTCDateString, isUniqueKeyedFunction, isUsStateCodeString, isValidLatLngPoint, isValidLatitude, isValidLongitude, isValidNumberBound, isValidPhoneExtensionNumber, isValidSlashPath, isWebsiteUrl, isWebsiteUrlWithPrefix, isWithinLatLngBoundFunction, isolateSlashPath, isolateSlashPathFunction, isolateWebsitePathFunction, itemCountForBatchIndex, iterableToArray, iterableToMap, iterableToSet, iterablesAreSetEquivalent, iterate, iterateFilteredPages, joinHostAndPort, joinStringsWithSpaces, keepCharactersAfterFirstCharacterOccurence, keepCharactersAfterFirstCharacterOccurenceFunction, keepFromSetCopy, keepValuesFromArray, keepValuesFromSet, keyValueMapFactory, labeledValueMap, lastValue, latLngBound, latLngBoundCenterPoint, latLngBoundEastBound, latLngBoundFromInput, latLngBoundFullyWrapsMap, latLngBoundFunction, latLngBoundNorthBound, latLngBoundNorthEastPoint, latLngBoundNorthWestPoint, latLngBoundOverlapsLatLngBound, latLngBoundSouthBound, latLngBoundSouthEastPoint, latLngBoundSouthWestPoint, latLngBoundStrictlyWrapsMap, latLngBoundTuple, latLngBoundTupleFunction, latLngBoundWestBound, latLngBoundWrapsMap, latLngDataPointFunction, latLngPoint, latLngPointFromString, latLngPointFunction, latLngPointPrecisionFunction, latLngString, latLngStringFunction, latLngTuple, latLngTupleFunction, limitArray, lonLatTuple, lowercaseFirstLetter, mailToUrlString, makeBestFit, makeCopyModelFieldFunction, makeDateMonthForMonthOfYear, makeGetter, makeHandler, makeHashDecodeMap, makeKeyPairs, makeModelConversionFieldValuesFunction, makeModelMap, makeModelMapFunctions, makeMultiModelKeyMap, makeValuesGroupMap, makeWithFactory, makeWithFactoryInput, mapArrayFunction, mapFunctionOutput, mapFunctionOutputPair, mapGetter, mapGetterFactory, mapIdentityFunction, mapIterable, mapKeysIntersectionObjectToArray, mapMaybeFunction, mapObjectKeysFunction, mapObjectKeysToLowercase, mapObjectMap, mapObjectMapFunction, mapObjectToTargetObject, mapPromiseOrValue, mapToObject, mapToTuples, mapValuesToSet, mappedUseAsyncFunction, mappedUseFunction, mapsHaveSameKeys, maybeMergeModelModifiers, maybeMergeModifiers, maybeModifierMapToFunction, maybeSet, mergeArrays, mergeArraysIntoArray, mergeFilterFunctions, mergeModifiers, mergeObjects, mergeObjectsFunction, mergeSlashPaths, messageFromError, minAndMaxFunction, minAndMaxIndex, minAndMaxIndexFunction, minAndMaxIndexItemsFunction, minAndMaxNumber, minutesToFractionalHours, minutesToHoursAndMinutes, modelFieldConversions, modelFieldMapFunction, modelFieldMapFunctions, modelTypeDataPairFactory, modifier, modifierMapToFunction, modifyModelMapFunction, modifyModelMapFunctions, monthDaySlashDateToDateString, monthOfYearFromDate, monthOfYearFromDateMonth, multiKeyValueMapFactory, multiValueMapBuilder, neMostLatLngPoint, nearestDivisibleValues, numberStringDencoder, numberStringDencoderDecodedNumberValueFunction, numberStringDencoderEncodedStringValueFunction, numberStringDencoderFunction, objectCopyFactory, objectDeltaArrayCompressor, objectFieldEqualityChecker, objectFlatMergeMatrix, objectHasKey, objectHasKeys, objectHasNoKeys, objectIsEmpty, objectKeyEqualityComparatorFunction, objectKeysEqualityComparatorFunction, objectMergeMatrix, objectToMap, objectToTuples, overlapsLatLngBoundFunction, overrideInObject, overrideInObjectFunctionFactory, padStartFunction, pairGroupValues, parseISO8601DayStringToUTCDate, partialServerError, passThrough, percentNumberFromDecimal, percentNumberToDecimal, performAsyncTask, performAsyncTasks, performBatchLoop, performMakeLoop, performTaskCountLoop, performTaskLoop, performTasksFromFactoryInParallelFunction, performTasksInParallel, performTasksInParallelFunction, pickOneRandomly, poll, primativeKeyDencoder, primativeKeyDencoderMap, primativeKeyStringDencoder, primativeValuesDelta, promiseReference, protectedFactory, pushArrayItemsIntoArray, pushElementOntoArray, pushItemOrArrayItemsIntoArray, randomArrayFactory, randomArrayIndex, randomBoolean, randomEmailFactory, randomFromArrayFactory, randomLatLngFactory, randomLatLngFromCenterFactory, randomNumber, randomNumberFactory, randomPhoneNumberFactory, randomPickFactory, range, rangedIndexedValuesArrayAccessorFactory, rangedIndexedValuesArrayAccessorInfoFactory, readBooleanKeySafetyWrap, readDomainFromEmailAddress, readDomainsFromEmailAddresses, readEmailDomainFromUrlOrEmailAddress, readIndexNumber, readKeysFrom, readKeysFromFilterUniqueFunctionAdditionalKeys, readKeysFromFilterUniqueFunctionAdditionalKeysInput, readKeysFunction, readKeysSetFrom, readKeysSetFunction, readKeysToMap, readModelKey, readModelKeyFromObject, readModelKeys, readModelKeysFromObjects, readMultipleKeysToMap, readPortNumber, readUniqueModelKey, readWebsiteProtocol, readableError, readableStreamToBase64, readableStreamToBuffer, readableStreamToStringFunction, rectangleOverlapsRectangle, reduceBooleansFn, reduceBooleansWithAnd, reduceBooleansWithAndFn, reduceBooleansWithOr, reduceBooleansWithOrFn, reduceNumbers, reduceNumbersFn, reduceNumbersWithAdd, reduceNumbersWithAddFn, reduceNumbersWithMax, reduceNumbersWithMaxFn, reduceNumbersWithMin, reduceNumbersWithMinFn, removeByKeyFromBooleanKeyArray, removeCharactersAfterFirstCharacterOccurence, removeCharactersAfterFirstCharacterOccurenceFunction, removeExtensionFromPhoneNumber, removeFromBooleanKeyArray, removeFromSet, removeFromSetCopy, removeHttpFromUrl, removeModelsWithKey, removeModelsWithSameKey, removeModifiers, removeTrailingFileTypeSeparators, removeTrailingSlashes, removeValuesAtIndexesFromArrayCopy, removeWebProtocolPrefix, repeatString, replaceCharacterAtIndexIf, replaceCharacterAtIndexWith, replaceInvalidFilePathTypeSeparatorsInSlashPath, replaceInvalidFilePathTypeSeparatorsInSlashPathFunction, replaceLastCharacterIf, replaceLastCharacterIfIsFunction, replaceMultipleFilePathsInSlashPath, replaceStringsFunction, requireModelKey, resetPeriodPromiseRateLimiter, restoreOrder, restoreOrderWithValues, reverseCompareFn, roundNumberToStepFunction, roundNumberUpToStep, roundToPrecision, roundToPrecisionFunction, roundingFunction, runAsyncTaskForValue, runAsyncTasksForValues, safeCompareEquality, safeEqualityComparatorFunction, safeFindBestIndexMatch, searchStringFilterFunction, separateValues, separateValuesToSets, sequentialIncrementingNumberStringModelIdFactory, serverError, setContainsAllValues, setContainsAnyValue, setContainsNoneOfValue, setDeltaChangeKeys, setDeltaFunction, setHasValueFunction, setIncludes, setIncludesFunction, setKeysOnMap, setWebProtocolPrefix, setsAreEquivalent, simpleSortValuesFunctionWithSortRef, slashPathFactory, slashPathInvalidError, slashPathName, slashPathParts, slashPathStartTypeFactory, slashPathType, slashPathValidationFactory, sliceIndexRangeFunction, sortAscendingIndexNumberRefFunction, sortByIndexAscendingCompareFunction, sortByIndexRangeAscendingCompareFunction, sortByLabelFunction, sortByNumberFunction, sortByStringFunction, sortCompareNumberFunction, sortNumbersAscendingFunction, sortValues, sortValuesFunctionOrMapIdentityWithSortRef, sortValuesFunctionWithSortRef, spaceSeparatedCssClasses, splitCommaSeparatedString, splitCommaSeparatedStringToSet, splitJoinNameString, splitJoinRemainder, splitStringAtFirstCharacterOccurence, splitStringAtFirstCharacterOccurenceFunction, splitStringAtIndex, splitStringTreeFactory, startOfDayForSystemDateInUTC, startOfDayForUTCDateInUTC, stepsFromIndex, stepsFromIndexFunction, stringCharactersToIndexRecord, stringContains, stringFactoryFromFactory, stringToLowercaseFunction, stringToUppercaseFunction, stringTrimFunction, sumOfIntegersBetween, swMostLatLngPoint, symmetricDifferenceArray, symmetricDifferenceArrayBetweenSets, symmetricDifferenceWithModels, takeFront, takeLast, takeValuesFromIterable, telUrlString, telUrlStringForE164PhoneNumberPair, terminatingFactoryFromArray, throwKeyIsRequired, timePeriodCounter, timer, toAbsoluteSlashPathStartType, toCaseInsensitiveStringArray, toMinuteOfDay, toModelFieldConversions, toModelMapFunctions, toReadableError, toRelativeSlashPathStartType, toggleInSet, toggleInSetCopy, toggleTimerRunning, transformNumberFunction, transformNumberFunctionConfig, transformStringFunction, transformStringFunctionConfig, transformStrings, trimArray, tryWithPromiseFactoriesFunction, typedServiceRegistry, unique, uniqueCaseInsensitiveStrings, uniqueCaseInsensitiveStringsSet, uniqueKeys, uniqueModels, unitedStatesAddressString, updateMaybeValue, urlWithoutParameters, useAsync, useCallback, useContextFunction, useIterableOrValue, useModelOrKey, usePromise, useValue, validLatLngPoint, validLatLngPointFunction, valueAtIndex, valuesAreBothNullishOrEquivalent, valuesFromPOJO, valuesFromPOJOFunction, vectorMinimumSizeResizeFunction, vectorsAreEqual, waitForMs, websiteDomainAndPathPair, websiteDomainAndPathPairFromWebsiteUrl, websitePathAndQueryPair, websitePathFromWebsiteDomainAndPath, websitePathFromWebsiteUrl, websiteUrlFromPaths, wrapIndexRangeFunction, wrapLatLngPoint, wrapLngValue, wrapMapFunctionOutput, wrapNumberFunction, wrapTuples, wrapUseAsyncFunction, wrapUseFunction };
17786
+ export { ALL_DOUBLE_SLASHES_REGEX, ALL_SLASHES_REGEX, ALL_SLASH_PATH_FILE_TYPE_SEPARATORS_REGEX, ASSERTION_ERROR_CODE, ASSERTION_HANDLER, AUTH_ADMIN_ROLE, AUTH_ONBOARDED_ROLE, AUTH_ROLE_CLAIMS_DEFAULT_CLAIM_VALUE, AUTH_ROLE_CLAIMS_DEFAULT_EMPTY_VALUE, AUTH_TOS_SIGNED_ROLE, AUTH_USER_ROLE, AbstractUniqueModel, Assert, AssertMax, AssertMin, AssertionError, AssertionIssueHandler, BooleanStringKeyArrayUtility, BooleanStringKeyArrayUtilityInstance, CATCH_ALL_HANDLE_RESULT_KEY, CUT_VALUE_TO_ZERO_PRECISION, DATE_NOW_VALUE, DEFAULT_CUT_STRING_END_TEXT, DEFAULT_LAT_LNG_STRING_VALUE, DEFAULT_RANDOM_EMAIL_FACTORY_CONFIG, DEFAULT_RANDOM_PHONE_NUMBER_FACTORY_CONFIG, DEFAULT_READABLE_ERROR_CODE, DEFAULT_SLASH_PATH_ILLEGAL_CHARACTERS, DEFAULT_SLASH_PATH_ILLEGAL_CHARACTER_REPLACEMENT, DEFAULT_UNKNOWN_MODEL_TYPE_STRING, DOLLAR_AMOUNT_PRECISION, DOLLAR_AMOUNT_STRING_REGEX, DataDoesNotExistError, DataIsExpiredError, Day, DestroyFunctionObject, E164PHONE_NUMBER_REGEX, E164PHONE_NUMBER_WITH_EXTENSION_REGEX, E164PHONE_NUMBER_WITH_OPTIONAL_EXTENSION_REGEX, FINAL_PAGE, FIRST_PAGE, FRACTIONAL_HOURS_PRECISION_FUNCTION, FullStorageObject, HAS_PORT_NUMBER_REGEX, HAS_WEBSITE_DOMAIN_NAME_REGEX, HOURS_IN_DAY, HTTP_OR_HTTPS_REGEX, HashSet, ISO8601_DAY_STRING_REGEX, ISO8601_DAY_STRING_START_REGEX, ISO_8601_DATE_STRING_REGEX, KeyValueTypleValueFilter, LAT_LNG_PATTERN, LAT_LNG_PATTERN_MAX_PRECISION, LAT_LONG_100KM_PRECISION, LAT_LONG_100M_PRECISION, LAT_LONG_10CM_PRECISION, LAT_LONG_10KM_PRECISION, LAT_LONG_10M_PRECISION, LAT_LONG_1CM_PRECISION, LAT_LONG_1KM_PRECISION, LAT_LONG_1MM_PRECISION, LAT_LONG_1M_PRECISION, LAT_LONG_GRAINS_OF_SAND_PRECISION, LEADING_SLASHES_REGEX, MAP_IDENTITY, MAX_BITWISE_SET_SIZE, MAX_LATITUDE_VALUE, MAX_LONGITUDE_VALUE, MINUTES_IN_DAY, MINUTES_IN_HOUR, MINUTE_OF_DAY_MAXMIMUM, MINUTE_OF_DAY_MINIUMUM, MIN_LATITUDE_VALUE, MIN_LONGITUDE_VALUE, MONTH_DAY_SLASH_DATE_STRING_REGEX, MS_IN_DAY, MS_IN_HOUR, MS_IN_MINUTE, MS_IN_SECOND, MemoryStorageInstance, ModelRelationUtility, NOOP_MODIFIER, NUMBER_STRING_DENCODER_64, NUMBER_STRING_DENCODER_64_DEFAULT_NEGATIVE_PREFIX, NUMBER_STRING_DENCODER_64_DIGITS, PHONE_EXTENSION_NUMBER_REGEX, PRIMATIVE_KEY_DENCODER_VALUE, PageCalculator, PropertyDescriptorUtility, REGEX_SPECIAL_CHARACTERS, REGEX_SPECIAL_CHARACTERS_SET, RelationChange, SECONDS_IN_MINUTE, SHARED_MEMORY_STORAGE, SLASH_PATH_FILE_TYPE_SEPARATOR, SLASH_PATH_SEPARATOR, SORT_VALUE_EQUAL, SORT_VALUE_GREATER_THAN, SORT_VALUE_LESS_THAN, SPLIT_STRING_TREE_NODE_ROOT_VALUE, ServerErrorResponse, SetDeltaChange, SimpleStorageObject, StorageObject, StorageObjectUtility, StoredDataError, SyncState, TOTAL_LATITUDE_RANGE, TOTAL_LONGITUDE_RANGE, TOTAL_SPAN_OF_LONGITUDE, TRAILING_FILE_TYPE_SEPARATORS_REGEX, TRAILING_SLASHES_REGEX, TimeAM, TimerCancelledError, TimerInstance, TypedServiceRegistryInstance, UNLOADED_PAGE, UNSET_INDEX_NUMBER, US_STATE_CODE_STRING_REGEX, UTC_DATE_STRING_REGEX, UTC_TIMEZONE_STRING, UTF_8_START_CHARACTER, UTF_PRIVATE_USAGE_AREA_START, UnauthorizedServerErrorResponse, WEBSITE_TLD_DETECTION_REGEX, WEB_PROTOCOL_PREFIX_REGEX, ZIP_CODE_STRING_REGEX, addHttpToUrl, addLatLngPoints, addMilliseconds, addModifiers, addPlusPrefixToNumber, addPrefix, addPrefixFunction, addSuffix, addSuffixFunction, addToSet, addToSetCopy, addToSplitStringTree, allFalsyOrEmptyKeys, allIndexesInIndexRange, allKeyValueTuples, allMaybeSoKeys, allNonUndefinedKeys, allObjectsAreEqual, allValuesAreMaybeNot, allValuesAreNotMaybe, allowValueOnceFilter, applyBestFit, applySplitStringTreeWithMultipleValues, applyToMultipleFields, approximateTimerEndDate, areEqualContext, areEqualPOJOValues, areEqualPOJOValuesUsingPojoFilter, arrayContainsDuplicateValue, arrayContentsDiffer, arrayDecision, arrayDecisionFunction, arrayFactory, arrayInputFactory, arrayToLowercase, arrayToMap, arrayToObject, arrayToUppercase, asArray, asDecisionFunction, asGetter, asIndexRangeCheckFunctionConfig, asIterable, asMinuteOfDay, asNumber, asObjectCopyFactory, asPromise, asSet, assignValuesToPOJO, assignValuesToPOJOFunction, authClaims, authRoleClaimsService, authRolesSetHasRoles, baseWebsiteUrl, batch, batchCalc, bitwiseObjectDencoder, bitwiseObjectEncoder, bitwiseObjectdecoder, bitwiseSetDecoder, bitwiseSetDencoder, booleanFactory, booleanKeyArrayUtility, boundNumber, boundNumberFunction, boundToRectangle, build, cachedGetter, calculateExpirationDate, capLatValue, capitalizeFirstLetter, caseInsensitiveFilterByIndexOfDecisionFactory, caseInsensitiveString, catchAllHandlerKey, chainMapFunction, chainMapSameFunctions, checkAnyHaveExpired, checkAtleastOneNotExpired, coerceToEmailParticipants, combineMaps, compareEqualityWithValueFromItemsFunction, compareEqualityWithValueFromItemsFunctionFactory, compareFnOrder, compareWithMappedValuesFunction, computeNextFractionalHour, computeNextFreeIndexFunction, computeNextFreeIndexOnSortedValuesFunction, concatArrays, concatArraysUnique, containsAllStringsAnyCase, containsAllValues, containsAnyStringAnyCase, containsAnyValue, containsAnyValueFromSet, containsNoValueFromSet, containsNoneOfValue, containsStringAnyCase, convertEmailParticipantStringToParticipant, convertMaybeToArray, convertParticipantToEmailParticipantString, convertToArray, copyArray, copyField, copyLatLngBound, copyLatLngPoint, copyObject, copySetAndDo, countAllInNestedArray, countPOJOKeys, countPOJOKeysFunction, cronExpressionRepeatingEveryNMinutes, cssClassesSet, cutString, cutStringFunction, cutToPrecision, cutValueToInteger, cutValueToPrecision, cutValueToPrecisionFunction, dateFromDateOrTimeNumber, dateFromLogicalDate, dateFromMinuteOfDay, dateToHoursAndMinutes, dateToMinuteOfDay, dayOfWeek, daysOfWeekArray, daysOfWeekFromEnabledDays, daysOfWeekNameFunction, daysOfWeekNameMap, decisionFunction, decodeHashedValues, decodeHashedValuesWithDecodeMap, decodeModelKeyTypePair, defaultFilterFromPOJOFunctionNoCopy, defaultForwardFunctionFactory, defaultLatLngPoint, defaultLatLngString, dencodeBitwiseSet, diffLatLngBoundPoints, diffLatLngPoints, dollarAmountString, e164PhoneNumberExtensionPair, e164PhoneNumberFromE164PhoneNumberExtensionPair, enabledDaysFromDaysOfWeek, encodeBitwiseSet, encodeModelKeyTypePair, errorMessageContainsString, errorMessageContainsStringFunction, escapeStringCharactersFunction, escapeStringForRegex, excludeValues, excludeValuesFromArray, excludeValuesFromSet, existsInIterable, expandArrayMapTuples, expandArrayValueTuples, expandFlattenTreeFunction, expandIndexSet, expandTreeFunction, expandTrees, expirationDetails, exponentialPromiseRateLimiter, extendLatLngBound, filterAndMapFunction, filterEmptyArrayValues, filterEmptyValues, filterFalsyAndEmptyValues, filterFromIterable, filterFromPOJO, filterFromPOJOFunction, filterKeyValueTupleFunction, filterKeyValueTuples, filterKeyValueTuplesFunction, filterKeyValueTuplesInputToFilter, filterKeysOnPOJOFunction, filterMaybeArrayFunction, filterMaybeArrayValues, filterMaybeValues, filterNullAndUndefinedValues, filterOnlyUndefinedValues, filterTuplesOnPOJOFunction, filterUndefinedValues, filterUniqueByIndex, filterUniqueCaseInsensitiveStrings, filterUniqueFunction, filterUniqueTransform, filterUniqueValues, filterValuesByDistance, filterValuesByDistanceNoOrder, filterValuesToSet, filterValuesUsingSet, filteredPage, findAllCharacterOccurences, findAllCharacterOccurencesFunction, findBest, findBestIndexMatch, findBestIndexMatchFunction, findBestIndexSetPair, findBestSplitStringTreeChildMatch, findBestSplitStringTreeChildMatchPath, findBestSplitStringTreeMatch, findBestSplitStringTreeMatchPath, findFirstCharacterOccurence, findInIterable, findIndexOfFirstDuplicateValue, findItemsByIndex, findNext, findPOJOKeys, findPOJOKeysFunction, findStringsRegexString, findToIndexSet, findValuesFrom, firstAndLastCharacterOccurrence, firstAndLastValue, firstValue, firstValueFromIterable, fitToIndexRangeFunction, fixExtraQueryParameters, fixMultiSlashesInSlashPath, flattenArray, flattenArrayOrValueArray, flattenArrayToSet, flattenArrayUnique, flattenArrayUniqueCaseInsensitiveStrings, flattenTree, flattenTreeToArray, flattenTreeToArrayFunction, flattenTrees, forEachInIterable, forEachKeyValue, forEachKeyValueOnPOJOFunction, forEachWithArray, forwardFunction, fractionalHoursToMinutes, generateIfDoesNotExist, getArrayNextIndex, getBaseLog, getDayOffset, getDayTomorrow, getDayYesterday, getDaysOfWeekNames, getFunctionType, getNextDay, getNextPageNumber, getOverlappingRectangle, getPageNumber, getPreviousDay, getValueFromGetter, groupValues, handlerBindAccessor, handlerConfigurerFactory, handlerFactory, handlerMappedSetFunction, handlerMappedSetFunctionFactory, handlerSetFunction, hasDifferentStringsNoCase, hasDifferentValues, hasHttpPrefix, hasNonNullValue, hasPortNumber, hasSameTimezone, hasSameValues, hasValueFunction, hasValueOrNotEmpty, hasValueOrNotEmptyObject, hasWebsiteDomain, hasWebsiteTopLevelDomain, hashSetForIndexed, hourToFractionalHour, idBatchFactory, incrementingNumberFactory, indexDeltaGroup, indexDeltaGroupFunction, indexRange, indexRangeCheckFunction, indexRangeCheckReaderFunction, indexRangeForArray, indexRangeOverlapsIndexRange, indexRangeOverlapsIndexRangeFunction, indexRangeReaderPairFactory, indexRefMap, indexedValuesArrayAccessorFactory, insertIntoBooleanKeyArray, invertBooleanReturnFunction, invertDecision, invertFilter, isAllowed, isClassLikeType, isCompleteUnitedStatesAddress, isConsideredUtcTimezoneString, isDate, isDefaultLatLngPoint, isDefaultLatLngPointValue, isDefaultReadableError, isDefinedAndNotFalse, isDollarAmountString, isE164PhoneNumber, isE164PhoneNumberWithExtension, isEmptyIterable, isEqualContext, isEqualDate, isEqualToValueDecisionFunction, isEvenNumber, isFalseBooleanKeyArray, isFinalPage, isGetter, isISO8601DateString, isISO8601DayString, isISO8601DayStringStart, isInAllowedDaysOfWeekSet, isInNumberBoundFunction, isInSetDecisionFunction, isIndexNumberInIndexRange, isIndexNumberInIndexRangeFunction, isIndexRangeInIndexRange, isIndexRangeInIndexRangeFunction, isIterable, isKnownHttpWebsiteProtocol, isLatLngBound, isLatLngBoundWithinLatLngBound, isLatLngPoint, isLatLngPointWithinLatLngBound, isLatLngString, isLogicalDateStringCode, isMapIdentityFunction, isMaybeNot, isMaybeNotOrTrue, isMaybeSo, isMinuteOfDay, isModelKey, isMonthDaySlashDate, isNonClassFunction, isNotNullOrEmptyString, isNumberDivisibleBy, isObjectWithConstructor, isOddNumber, isPast, isPromise, isPromiseLike, isSameLatLngBound, isSameLatLngPoint, isSameNonNullValue, isSameVector, isSelectedDecisionFunctionFactory, isSelectedIndexDecisionFunction, isServerError, isSlashPathFile, isSlashPathFolder, isSlashPathTypedFile, isStandardInternetAccessibleWebsiteUrl, isStringOrTrue, isThrottled, isTrueBooleanKeyArray, isUTCDateString, isUniqueKeyedFunction, isUsStateCodeString, isValidLatLngPoint, isValidLatitude, isValidLongitude, isValidNumberBound, isValidPhoneExtensionNumber, isValidSlashPath, isWebsiteUrl, isWebsiteUrlWithPrefix, isWithinLatLngBoundFunction, isolateSlashPath, isolateSlashPathFunction, isolateWebsitePathFunction, itemCountForBatchIndex, iterableToArray, iterableToMap, iterableToSet, iterablesAreSetEquivalent, iterate, iterateFilteredPages, joinHostAndPort, joinStringsWithSpaces, keepCharactersAfterFirstCharacterOccurence, keepCharactersAfterFirstCharacterOccurenceFunction, keepFromSetCopy, keepValuesFromArray, keepValuesFromSet, keyValueMapFactory, labeledValueMap, lastValue, latLngBound, latLngBoundCenterPoint, latLngBoundEastBound, latLngBoundFromInput, latLngBoundFullyWrapsMap, latLngBoundFunction, latLngBoundNorthBound, latLngBoundNorthEastPoint, latLngBoundNorthWestPoint, latLngBoundOverlapsLatLngBound, latLngBoundSouthBound, latLngBoundSouthEastPoint, latLngBoundSouthWestPoint, latLngBoundStrictlyWrapsMap, latLngBoundTuple, latLngBoundTupleFunction, latLngBoundWestBound, latLngBoundWrapsMap, latLngDataPointFunction, latLngPoint, latLngPointFromString, latLngPointFunction, latLngPointPrecisionFunction, latLngString, latLngStringFunction, latLngTuple, latLngTupleFunction, limitArray, lonLatTuple, lowercaseFirstLetter, mailToUrlString, makeBestFit, makeCopyModelFieldFunction, makeDateMonthForMonthOfYear, makeGetter, makeHandler, makeHashDecodeMap, makeKeyPairs, makeModelConversionFieldValuesFunction, makeModelMap, makeModelMapFunctions, makeMultiModelKeyMap, makeValuesGroupMap, makeWithFactory, makeWithFactoryInput, mapArrayFunction, mapFunctionOutput, mapFunctionOutputPair, mapGetter, mapGetterFactory, mapIdentityFunction, mapIterable, mapKeysIntersectionObjectToArray, mapMaybeFunction, mapObjectKeysFunction, mapObjectKeysToLowercase, mapObjectMap, mapObjectMapFunction, mapObjectToTargetObject, mapPromiseOrValue, mapToObject, mapToTuples, mapValuesToSet, mappedUseAsyncFunction, mappedUseFunction, mapsHaveSameKeys, maybeMergeModelModifiers, maybeMergeModifiers, maybeModifierMapToFunction, maybeSet, mergeArrays, mergeArraysIntoArray, mergeFilterFunctions, mergeModifiers, mergeObjects, mergeObjectsFunction, mergeSlashPaths, messageFromError, minAndMaxFunction, minAndMaxIndex, minAndMaxIndexFunction, minAndMaxIndexItemsFunction, minAndMaxNumber, minutesToFractionalHours, minutesToHoursAndMinutes, modelFieldConversions, modelFieldMapFunction, modelFieldMapFunctions, modelTypeDataPairFactory, modifier, modifierMapToFunction, modifyModelMapFunction, modifyModelMapFunctions, monthDaySlashDateToDateString, monthOfYearFromDate, monthOfYearFromDateMonth, multiKeyValueMapFactory, multiValueMapBuilder, neMostLatLngPoint, nearestDivisibleValues, numberStringDencoder, numberStringDencoderDecodedNumberValueFunction, numberStringDencoderEncodedStringValueFunction, numberStringDencoderFunction, objectCopyFactory, objectDeltaArrayCompressor, objectFieldEqualityChecker, objectFlatMergeMatrix, objectHasKey, objectHasKeys, objectHasNoKeys, objectIsEmpty, objectKeyEqualityComparatorFunction, objectKeysEqualityComparatorFunction, objectMergeMatrix, objectToMap, objectToTuples, overlapsLatLngBoundFunction, overrideInObject, overrideInObjectFunctionFactory, padStartFunction, pairGroupValues, parseISO8601DayStringToUTCDate, partialServerError, passThrough, percentNumberFromDecimal, percentNumberToDecimal, performAsyncTask, performAsyncTasks, performBatchLoop, performMakeLoop, performTaskCountLoop, performTaskLoop, performTasksFromFactoryInParallelFunction, performTasksInParallel, performTasksInParallelFunction, pickOneRandomly, poll, primativeKeyDencoder, primativeKeyDencoderMap, primativeKeyStringDencoder, primativeValuesDelta, promiseReference, protectedFactory, pushArrayItemsIntoArray, pushElementOntoArray, pushItemOrArrayItemsIntoArray, randomArrayFactory, randomArrayIndex, randomBoolean, randomEmailFactory, randomFromArrayFactory, randomLatLngFactory, randomLatLngFromCenterFactory, randomNumber, randomNumberFactory, randomPhoneNumberFactory, randomPickFactory, range, rangedIndexedValuesArrayAccessorFactory, rangedIndexedValuesArrayAccessorInfoFactory, readBooleanKeySafetyWrap, readDomainFromEmailAddress, readDomainsFromEmailAddresses, readEmailDomainFromUrlOrEmailAddress, readIndexNumber, readKeysFrom, readKeysFromFilterUniqueFunctionAdditionalKeys, readKeysFromFilterUniqueFunctionAdditionalKeysInput, readKeysFunction, readKeysSetFrom, readKeysSetFunction, readKeysToMap, readModelKey, readModelKeyFromObject, readModelKeys, readModelKeysFromObjects, readMultipleKeysToMap, readPortNumber, readUniqueModelKey, readWebsiteProtocol, readableError, readableStreamToBase64, readableStreamToBuffer, readableStreamToStringFunction, rectangleOverlapsRectangle, reduceBooleansFn, reduceBooleansWithAnd, reduceBooleansWithAndFn, reduceBooleansWithOr, reduceBooleansWithOrFn, reduceNumbers, reduceNumbersFn, reduceNumbersWithAdd, reduceNumbersWithAddFn, reduceNumbersWithMax, reduceNumbersWithMaxFn, reduceNumbersWithMin, reduceNumbersWithMinFn, removeByKeyFromBooleanKeyArray, removeCharactersAfterFirstCharacterOccurence, removeCharactersAfterFirstCharacterOccurenceFunction, removeExtensionFromPhoneNumber, removeFromBooleanKeyArray, removeFromSet, removeFromSetCopy, removeHttpFromUrl, removeModelsWithKey, removeModelsWithSameKey, removeModifiers, removeTrailingFileTypeSeparators, removeTrailingSlashes, removeValuesAtIndexesFromArrayCopy, removeWebProtocolPrefix, repeatString, replaceCharacterAtIndexIf, replaceCharacterAtIndexWith, replaceInvalidFilePathTypeSeparatorsInSlashPath, replaceInvalidFilePathTypeSeparatorsInSlashPathFunction, replaceLastCharacterIf, replaceLastCharacterIfIsFunction, replaceMultipleFilePathsInSlashPath, replaceStringsFunction, requireModelKey, resetPeriodPromiseRateLimiter, restoreOrder, restoreOrderWithValues, reverseCompareFn, roundNumberToStepFunction, roundNumberUpToStep, roundToPrecision, roundToPrecisionFunction, roundingFunction, runAsyncTaskForValue, runAsyncTasksForValues, safeCompareEquality, safeEqualityComparatorFunction, safeFindBestIndexMatch, searchStringFilterFunction, separateValues, separateValuesToSets, sequentialIncrementingNumberStringModelIdFactory, serverError, setContainsAllValues, setContainsAnyValue, setContainsNoneOfValue, setDeltaChangeKeys, setDeltaFunction, setHasValueFunction, setIncludes, setIncludesFunction, setKeysOnMap, setWebProtocolPrefix, setsAreEquivalent, simpleSortValuesFunctionWithSortRef, slashPathFactory, slashPathInvalidError, slashPathName, slashPathParts, slashPathStartTypeFactory, slashPathType, slashPathValidationFactory, sliceIndexRangeFunction, sortAscendingIndexNumberRefFunction, sortByIndexAscendingCompareFunction, sortByIndexRangeAscendingCompareFunction, sortByLabelFunction, sortByNumberFunction, sortByStringFunction, sortCompareNumberFunction, sortNumbersAscendingFunction, sortValues, sortValuesFunctionOrMapIdentityWithSortRef, sortValuesFunctionWithSortRef, spaceSeparatedCssClasses, splitCommaSeparatedString, splitCommaSeparatedStringToSet, splitJoinNameString, splitJoinRemainder, splitStringAtFirstCharacterOccurence, splitStringAtFirstCharacterOccurenceFunction, splitStringAtIndex, splitStringTreeFactory, startOfDayForSystemDateInUTC, startOfDayForUTCDateInUTC, stepsFromIndex, stepsFromIndexFunction, stringCharactersToIndexRecord, stringContains, stringFactoryFromFactory, stringToLowercaseFunction, stringToUppercaseFunction, stringTrimFunction, sumOfIntegersBetween, swMostLatLngPoint, symmetricDifferenceArray, symmetricDifferenceArrayBetweenSets, symmetricDifferenceWithModels, takeFront, takeLast, takeValuesFromIterable, telUrlString, telUrlStringForE164PhoneNumberPair, terminatingFactoryFromArray, throwKeyIsRequired, timePeriodCounter, timer, toAbsoluteSlashPathStartType, toCaseInsensitiveStringArray, toMinuteOfDay, toModelFieldConversions, toModelMapFunctions, toReadableError, toRelativeSlashPathStartType, toggleInSet, toggleInSetCopy, toggleTimerRunning, transformNumberFunction, transformNumberFunctionConfig, transformStringFunction, transformStringFunctionConfig, transformStrings, trimArray, tryWithPromiseFactoriesFunction, typedServiceRegistry, unique, uniqueCaseInsensitiveStrings, uniqueCaseInsensitiveStringsSet, uniqueKeys, uniqueModels, unitedStatesAddressString, unixTimeNumberForNow, unixTimeNumberFromDate, unixTimeNumberFromDateOrTimeNumber, unixTimeNumberToDate, updateMaybeValue, urlWithoutParameters, useAsync, useCallback, useContextFunction, useIterableOrValue, useModelOrKey, usePromise, useValue, validLatLngPoint, validLatLngPointFunction, valueAtIndex, valuesAreBothNullishOrEquivalent, valuesFromPOJO, valuesFromPOJOFunction, vectorMinimumSizeResizeFunction, vectorsAreEqual, waitForMs, websiteDomainAndPathPair, websiteDomainAndPathPairFromWebsiteUrl, websitePathAndQueryPair, websitePathFromWebsiteDomainAndPath, websitePathFromWebsiteUrl, websiteUrlFromPaths, wrapIndexRangeFunction, wrapLatLngPoint, wrapLngValue, wrapMapFunctionOutput, wrapNumberFunction, wrapTuples, wrapUseAsyncFunction, wrapUseFunction };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util",
3
- "version": "11.1.4",
3
+ "version": "11.1.6",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -1,4 +1,4 @@
1
- import { type Maybe } from '../value/maybe.type';
1
+ import { type MaybeNot, type Maybe } from '../value/maybe.type';
2
2
  /**
3
3
  * The past or future direction.
4
4
  */
@@ -232,3 +232,14 @@ export declare function isEqualDate(a: Date, b: Date): boolean;
232
232
  * @returns
233
233
  */
234
234
  export declare function isPast(input: Date): boolean;
235
+ /**
236
+ * Adds milliseconds to the input date.
237
+ *
238
+ * If no date is input, then returns the input.
239
+ *
240
+ * @param input
241
+ * @param ms
242
+ */
243
+ export declare function addMilliseconds(input: Date, ms: Maybe<Milliseconds>): Date;
244
+ export declare function addMilliseconds(input: MaybeNot, ms: Maybe<Milliseconds>): MaybeNot;
245
+ export declare function addMilliseconds(input: Maybe<Date>, ms: Maybe<Milliseconds>): Maybe<Date>;
@@ -0,0 +1,37 @@
1
+ import { type Maybe, type MaybeNot } from '../value/maybe.type';
2
+ import { type DateOrUnixDateTimeNumber, type UnixDateTimeNumber } from './date';
3
+ /**
4
+ * Converts a Date object or unix timestamp number to a unix timestamp number.
5
+ *
6
+ * @param input - Date object or unix timestamp number to convert
7
+ * @returns Unix timestamp number if input is valid, null/undefined if input is null/undefined
8
+ */
9
+ export declare function unixTimeNumberFromDateOrTimeNumber(input: Maybe<DateOrUnixDateTimeNumber>): Maybe<UnixDateTimeNumber>;
10
+ /**
11
+ * Gets the current time as a unix timestamp number.
12
+ *
13
+ * @returns Current time as unix timestamp number
14
+ */
15
+ export declare function unixTimeNumberForNow(): UnixDateTimeNumber;
16
+ /**
17
+ * Converts a Date object to a unix timestamp number.
18
+ *
19
+ * @param date - Date object to convert
20
+ * @returns Unix timestamp number if date is valid, null/undefined if date is null/undefined
21
+ */
22
+ export declare function unixTimeNumberFromDate(date: Date): UnixDateTimeNumber;
23
+ export declare function unixTimeNumberFromDate(date: MaybeNot): MaybeNot;
24
+ /**
25
+ * Converts a Date object or unix timestamp number to a Date object.
26
+ *
27
+ * @param input - Date object or unix timestamp number to convert
28
+ * @returns Date object if input is valid, null/undefined if input is null/undefined
29
+ */
30
+ export declare function dateFromDateOrTimeNumber(input: Maybe<DateOrUnixDateTimeNumber>): Maybe<Date>;
31
+ /**
32
+ * Converts a unix timestamp number to a Date object.
33
+ *
34
+ * @param dateTimeNumber - Unix timestamp number to convert
35
+ * @returns Date object if timestamp is valid, null/undefined if timestamp is null/undefined
36
+ */
37
+ export declare function unixTimeNumberToDate(dateTimeNumber: Maybe<UnixDateTimeNumber>): Maybe<Date>;
@@ -0,0 +1,114 @@
1
+ import { type Maybe } from '../value/maybe.type';
2
+ import { type DateOrUnixDateTimeNumber, type Milliseconds } from './date';
3
+ /**
4
+ * An object that can expire.
5
+ */
6
+ export interface Expires {
7
+ /**
8
+ * Date this object expires at. If not defined, it has expired.
9
+ */
10
+ expiresAt?: Maybe<Date>;
11
+ }
12
+ /**
13
+ * expirationDetails() input.
14
+ *
15
+ * The priority that the expiration calculation uses takes the following order:
16
+ * 1. expires
17
+ * 2. expiresAt
18
+ * 3. date + expiresIn
19
+ */
20
+ export interface ExpirationDetailsInput<T extends Expires = Expires> extends Expires {
21
+ /**
22
+ * Existing expires instance to use.
23
+ *
24
+ * If provided/
25
+ */
26
+ expires?: Maybe<T>;
27
+ /**
28
+ * Default current now time to use.
29
+ *
30
+ * If not set, functions will use the current time when they are called.
31
+ */
32
+ now?: Maybe<Date>;
33
+ /**
34
+ * The base date or time number to calculate expirations from.
35
+ *
36
+ * If not defined, the expiresFromDate is considered to have never been run/set.
37
+ */
38
+ expiresFromDate?: Maybe<DateOrUnixDateTimeNumber>;
39
+ /**
40
+ * If true, the "expiresFromDate" will default to the calculated now time when calculating the expiration.
41
+ *
42
+ * Defaults to true.
43
+ */
44
+ defaultExpiresFromDateToNow?: Maybe<boolean>;
45
+ /**
46
+ * Time after "now" that expiration will occur.
47
+ */
48
+ expiresIn?: Maybe<Milliseconds>;
49
+ }
50
+ export interface ExpirationDetails<T extends Expires = Expires> {
51
+ /**
52
+ * Input used to create this instance.
53
+ */
54
+ readonly input: ExpirationDetailsInput<T>;
55
+ /**
56
+ * Returns true if the expiration time has passed.
57
+ *
58
+ * @param nowOverride Optional override for the current time. Defaults to the current time.
59
+ * @param defaultIfNoExpirationDate If true, returns true if no expiration date is defined. Defaults to false.
60
+ */
61
+ hasExpired(nowOverride?: Maybe<Date>, defaultIfNoExpirationDate?: boolean): boolean;
62
+ /**
63
+ * Returns the expiration date.
64
+ *
65
+ * Returns null if no expiration is defined.
66
+ *
67
+ * @param nowOverride Optional override for the current time. Defaults to the current time.
68
+ */
69
+ getExpirationDate(nowOverride?: Maybe<Date>): Maybe<Date>;
70
+ }
71
+ /**
72
+ * Returns expiration details for the input.
73
+ *
74
+ * @param input
75
+ * @returns
76
+ */
77
+ export declare function expirationDetails<T extends Expires = Expires>(input: ExpirationDetailsInput<T>): ExpirationDetails<T>;
78
+ /**
79
+ * Convenience function for calculating and returning the expiration date given the input.
80
+ *
81
+ * @param input Input used to calculate the expiration date.
82
+ * @returns The expiration date, if applicable.
83
+ */
84
+ export declare function calculateExpirationDate(input: ExpirationDetailsInput<any>): Maybe<Date>;
85
+ /**
86
+ * Convenience function for quickly calculating throttling given a throttle time and last run time.
87
+ *
88
+ * Returns true if the throttle time has not passed since the last run time, compared to now.
89
+
90
+ * @param throttleTime Time after "now" that expiration will occur.
91
+ * @param lastRunAt Time the last run occurred.
92
+ * @param now Optional override for the current time. Defaults to the current time.
93
+ * @returns
94
+ */
95
+ export declare function isThrottled(throttleTime: Maybe<Milliseconds>, lastRunAt: Maybe<DateOrUnixDateTimeNumber>, now?: Maybe<Date>): boolean;
96
+ /**
97
+ * Returns true if any of the input ExpirationDetails have not expired.
98
+ *
99
+ * If the list is empty, returns false.
100
+ *
101
+ * @param details List of ExpirationDetails to check.
102
+ * @returns True if any of the input ExpirationDetails have not expired.
103
+ */
104
+ export declare function checkAtleastOneNotExpired(details: ExpirationDetails<any>[]): boolean;
105
+ /**
106
+ * Returns true if any of the input ExpirationDetails have expired.
107
+ *
108
+ * If the list is empty, returns the value of the second argument.
109
+ *
110
+ * @param details List of ExpirationDetails to check.
111
+ * @param defaultIfEmpty Default value to return if the list is empty. True by default.
112
+ * @returns True if any of the input ExpirationDetails have expired.
113
+ */
114
+ export declare function checkAnyHaveExpired(details: ExpirationDetails<any>[], defaultIfEmpty?: boolean): boolean;
@@ -1,4 +1,6 @@
1
1
  export * from './date';
2
+ export * from './date.unix';
3
+ export * from './expires';
2
4
  export * from './week';
3
5
  export * from './hour';
4
6
  export * from './time';
package/test/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [11.1.6](https://github.com/dereekb/dbx-components/compare/v11.1.5-dev...v11.1.6) (2025-03-20)
6
+
7
+
8
+
9
+ ## [11.1.5](https://github.com/dereekb/dbx-components/compare/v11.1.4-dev...v11.1.5) (2025-03-20)
10
+
11
+
12
+
5
13
  ## [11.1.4](https://github.com/dereekb/dbx-components/compare/v11.1.3-dev...v11.1.4) (2025-03-17)
6
14
 
7
15
 
package/test/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "11.1.4",
3
+ "version": "11.1.6",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
6
  "@dereekb/util": "*"