@augment-vir/common 13.2.0 → 13.2.2

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.
Files changed (107) hide show
  1. package/dist/cjs/augments/async.js +1 -1
  2. package/dist/cjs/augments/object/matches-object-shape.js +2 -4
  3. package/dist/cjs/augments/object/object-entries.js +5 -4
  4. package/dist/cjs/augments/regexp.js +1 -1
  5. package/dist/cjs/augments/string/url.js +46 -2
  6. package/dist/esm/augments/async.js +1 -1
  7. package/dist/esm/augments/object/matches-object-shape.js +2 -4
  8. package/dist/esm/augments/object/object-entries.js +5 -4
  9. package/dist/esm/augments/regexp.js +1 -1
  10. package/dist/esm/augments/string/url.js +46 -2
  11. package/dist/types/augments/ansi.d.ts +0 -1
  12. package/dist/types/augments/array.d.ts +0 -1
  13. package/dist/types/augments/async.d.ts +0 -1
  14. package/dist/types/augments/common-number.d.ts +0 -1
  15. package/dist/types/augments/common-string.d.ts +0 -1
  16. package/dist/types/augments/date/date.d.ts +0 -1
  17. package/dist/types/augments/date/relative-date.d.ts +0 -1
  18. package/dist/types/augments/environment.d.ts +0 -1
  19. package/dist/types/augments/error.d.ts +0 -1
  20. package/dist/types/augments/function.d.ts +0 -1
  21. package/dist/types/augments/json-compatible.d.ts +0 -1
  22. package/dist/types/augments/json.d.ts +0 -1
  23. package/dist/types/augments/object/enum.d.ts +0 -1
  24. package/dist/types/augments/object/filter-object.d.ts +0 -1
  25. package/dist/types/augments/object/has-key.d.ts +0 -1
  26. package/dist/types/augments/object/jsonify.d.ts +0 -1
  27. package/dist/types/augments/object/map-object.d.ts +0 -1
  28. package/dist/types/augments/object/matches-object-shape.d.ts +0 -1
  29. package/dist/types/augments/object/nested-keys.d.ts +0 -1
  30. package/dist/types/augments/object/object-entries.d.ts +0 -1
  31. package/dist/types/augments/object/object.d.ts +0 -1
  32. package/dist/types/augments/object/pick-deep.d.ts +0 -1
  33. package/dist/types/augments/object/typed-has-property.d.ts +0 -1
  34. package/dist/types/augments/promise.d.ts +0 -1
  35. package/dist/types/augments/regexp.d.ts +0 -1
  36. package/dist/types/augments/runtime-type-of.d.ts +0 -1
  37. package/dist/types/augments/string/url.d.ts +1 -2
  38. package/dist/types/augments/string/uuid.d.ts +0 -1
  39. package/dist/types/augments/truncate-number.d.ts +0 -1
  40. package/dist/types/augments/tuple.d.ts +0 -1
  41. package/dist/types/augments/type.d.ts +0 -1
  42. package/dist/types/index.d.ts +0 -1
  43. package/package.json +4 -4
  44. package/dist/cjs/augments/ansi.d.ts +0 -2
  45. package/dist/cjs/augments/array.d.ts +0 -14
  46. package/dist/cjs/augments/async.d.ts +0 -15
  47. package/dist/cjs/augments/common-number.d.ts +0 -26
  48. package/dist/cjs/augments/common-string.d.ts +0 -45
  49. package/dist/cjs/augments/date/date.d.ts +0 -27
  50. package/dist/cjs/augments/date/relative-date.d.ts +0 -12
  51. package/dist/cjs/augments/environment.d.ts +0 -2
  52. package/dist/cjs/augments/error.d.ts +0 -11
  53. package/dist/cjs/augments/function.d.ts +0 -27
  54. package/dist/cjs/augments/json-compatible.d.ts +0 -23
  55. package/dist/cjs/augments/json.d.ts +0 -6
  56. package/dist/cjs/augments/object/enum.d.ts +0 -5
  57. package/dist/cjs/augments/object/filter-object.d.ts +0 -5
  58. package/dist/cjs/augments/object/has-key.d.ts +0 -2
  59. package/dist/cjs/augments/object/jsonify.d.ts +0 -3
  60. package/dist/cjs/augments/object/map-object.d.ts +0 -25
  61. package/dist/cjs/augments/object/matches-object-shape.d.ts +0 -37
  62. package/dist/cjs/augments/object/nested-keys.d.ts +0 -12
  63. package/dist/cjs/augments/object/object-entries.d.ts +0 -6
  64. package/dist/cjs/augments/object/object.d.ts +0 -13
  65. package/dist/cjs/augments/object/pick-deep.d.ts +0 -8
  66. package/dist/cjs/augments/object/typed-has-property.d.ts +0 -8
  67. package/dist/cjs/augments/promise.d.ts +0 -28
  68. package/dist/cjs/augments/regexp.d.ts +0 -4
  69. package/dist/cjs/augments/runtime-type-of.d.ts +0 -20
  70. package/dist/cjs/augments/string/url.d.ts +0 -8
  71. package/dist/cjs/augments/string/uuid.d.ts +0 -2
  72. package/dist/cjs/augments/truncate-number.d.ts +0 -20
  73. package/dist/cjs/augments/tuple.d.ts +0 -9
  74. package/dist/cjs/augments/type.d.ts +0 -60
  75. package/dist/cjs/index.d.ts +0 -32
  76. package/dist/esm/augments/ansi.d.ts +0 -2
  77. package/dist/esm/augments/array.d.ts +0 -14
  78. package/dist/esm/augments/async.d.ts +0 -15
  79. package/dist/esm/augments/common-number.d.ts +0 -26
  80. package/dist/esm/augments/common-string.d.ts +0 -45
  81. package/dist/esm/augments/date/date.d.ts +0 -27
  82. package/dist/esm/augments/date/relative-date.d.ts +0 -12
  83. package/dist/esm/augments/environment.d.ts +0 -2
  84. package/dist/esm/augments/error.d.ts +0 -11
  85. package/dist/esm/augments/function.d.ts +0 -27
  86. package/dist/esm/augments/json-compatible.d.ts +0 -23
  87. package/dist/esm/augments/json.d.ts +0 -6
  88. package/dist/esm/augments/object/enum.d.ts +0 -5
  89. package/dist/esm/augments/object/filter-object.d.ts +0 -5
  90. package/dist/esm/augments/object/has-key.d.ts +0 -2
  91. package/dist/esm/augments/object/jsonify.d.ts +0 -3
  92. package/dist/esm/augments/object/map-object.d.ts +0 -25
  93. package/dist/esm/augments/object/matches-object-shape.d.ts +0 -37
  94. package/dist/esm/augments/object/nested-keys.d.ts +0 -12
  95. package/dist/esm/augments/object/object-entries.d.ts +0 -6
  96. package/dist/esm/augments/object/object.d.ts +0 -13
  97. package/dist/esm/augments/object/pick-deep.d.ts +0 -8
  98. package/dist/esm/augments/object/typed-has-property.d.ts +0 -8
  99. package/dist/esm/augments/promise.d.ts +0 -28
  100. package/dist/esm/augments/regexp.d.ts +0 -4
  101. package/dist/esm/augments/runtime-type-of.d.ts +0 -20
  102. package/dist/esm/augments/string/url.d.ts +0 -8
  103. package/dist/esm/augments/string/uuid.d.ts +0 -2
  104. package/dist/esm/augments/truncate-number.d.ts +0 -20
  105. package/dist/esm/augments/tuple.d.ts +0 -9
  106. package/dist/esm/augments/type.d.ts +0 -60
  107. package/dist/esm/index.d.ts +0 -32
@@ -21,7 +21,7 @@ async function awaitedBlockingMap(input, callback) {
21
21
  }
22
22
  exports.awaitedBlockingMap = awaitedBlockingMap;
23
23
  async function awaitedFilter(arrayInput, filterCallback, options) {
24
- const callbackResults = (options === null || options === void 0 ? void 0 : options.blocking)
24
+ const callbackResults = options?.blocking
25
25
  ? await awaitedBlockingMap(arrayInput, filterCallback)
26
26
  : await Promise.all(arrayInput.map(filterCallback));
27
27
  return arrayInput.filter((originalValue, index) => !!callbackResults[index]);
@@ -55,7 +55,6 @@ function assertMatchesObjectShape(testThisOne, compareToThisOne, allowExtraProps
55
55
  }
56
56
  }
57
57
  matchKeys.forEach((key) => {
58
- var _a;
59
58
  if (!(0, typed_has_property_1.typedHasProperty)(testThisOne, key)) {
60
59
  throw new Error(`test object does not have key "${String(key)}" from expected shape.`);
61
60
  }
@@ -65,13 +64,12 @@ function assertMatchesObjectShape(testThisOne, compareToThisOne, allowExtraProps
65
64
  const testValue = testThisOne[key];
66
65
  const shouldMatch = compareToThisOne[key];
67
66
  if (!noCheckInnerValueOfTheseKeys[key]) {
68
- compareInnerValue(testValue, shouldMatch, throwKeyError, allowExtraProps, (_a = noCheckInnerValueOfTheseKeys[key]) !== null && _a !== void 0 ? _a : {});
67
+ compareInnerValue(testValue, shouldMatch, throwKeyError, allowExtraProps, noCheckInnerValueOfTheseKeys[key] ?? {});
69
68
  }
70
69
  });
71
70
  }
72
71
  exports.assertMatchesObjectShape = assertMatchesObjectShape;
73
72
  function compareInnerValue(testValue, matchValue, throwKeyError, allowExtraProps, noCheckInnerValueOfTheseKeys) {
74
- var _a;
75
73
  const testType = typeof testValue;
76
74
  const shouldMatchType = typeof matchValue;
77
75
  if (testType !== shouldMatchType) {
@@ -81,7 +79,7 @@ function compareInnerValue(testValue, matchValue, throwKeyError, allowExtraProps
81
79
  if ((0, typed_has_property_1.typedHasProperty)(matchValue, 'constructor')) {
82
80
  if (!(0, typed_has_property_1.typedHasProperty)(testValue, 'constructor') ||
83
81
  testValue.constructor !== matchValue.constructor) {
84
- throwKeyError(`constructor "${(_a = testValue === null || testValue === void 0 ? void 0 : testValue.constructor) === null || _a === void 0 ? void 0 : _a.name}" did not match expected constructor "${matchValue.constructor}"`);
82
+ throwKeyError(`constructor "${testValue?.constructor?.name}" did not match expected constructor "${matchValue.constructor}"`);
85
83
  }
86
84
  }
87
85
  }
@@ -12,10 +12,11 @@ function getObjectTypedKeys(input) {
12
12
  reflectKeys = Reflect.ownKeys(input);
13
13
  }
14
14
  catch (error) { }
15
- return (reflectKeys !== null && reflectKeys !== void 0 ? reflectKeys : [
16
- ...Object.keys(input),
17
- ...Object.getOwnPropertySymbols(input),
18
- ]);
15
+ return (reflectKeys ??
16
+ [
17
+ ...Object.keys(input),
18
+ ...Object.getOwnPropertySymbols(input),
19
+ ]);
19
20
  }
20
21
  exports.getObjectTypedKeys = getObjectTypedKeys;
21
22
  function getObjectTypedValues(input) {
@@ -15,6 +15,6 @@ function addRegExpFlags(originalRegExp, flags) {
15
15
  exports.addRegExpFlags = addRegExpFlags;
16
16
  function safeMatch(input, regExp) {
17
17
  const match = input.match(regExp);
18
- return match !== null && match !== void 0 ? match : [];
18
+ return match ?? [];
19
19
  }
20
20
  exports.safeMatch = safeMatch;
@@ -4,7 +4,7 @@ exports.joinUrlParts = void 0;
4
4
  const protocolSplit = '://';
5
5
  /**
6
6
  * Joins all given arguments together as if they were parts of a URL. Preserves trailing slashes and
7
- * removes consecutive slashes in the path. This also encodes each part of the
7
+ * removes consecutive slashes in the path. This also encodes each URL part.
8
8
  *
9
9
  * @example: joinToUrl('https://example.com', 'path1', 'path2/', '/path3/') === 'https://example.com/path1/path2/path3/'
10
10
  */
@@ -16,10 +16,54 @@ function joinUrlParts(...urlParts) {
16
16
  '',
17
17
  rawJoined,
18
18
  ];
19
+ let mapSearchParamsStarted = false;
20
+ let reduceSearchParamsStarted = false;
19
21
  const fixedRest = rawRest
20
22
  .replace(/\/{2,}/g, '/')
21
23
  .split('/')
22
- .map((part) => encodeURIComponent(part));
24
+ .map((part) => {
25
+ if (part.includes('?') || mapSearchParamsStarted) {
26
+ mapSearchParamsStarted = true;
27
+ return part;
28
+ }
29
+ else {
30
+ return encodeURIComponent(part);
31
+ }
32
+ })
33
+ .reduce((fillingUpArray, currentEntry, currentIndex, inputArray) => {
34
+ if (reduceSearchParamsStarted) {
35
+ return fillingUpArray;
36
+ }
37
+ const nextEntry = inputArray[currentIndex + 1];
38
+ let newEntry = currentEntry;
39
+ const nextHasQuestion = !currentEntry.includes('?') && nextEntry?.startsWith('?');
40
+ if (nextEntry?.startsWith('?') || nextHasQuestion) {
41
+ reduceSearchParamsStarted = true;
42
+ let foundHash = false;
43
+ const subsequentSearchParams = inputArray
44
+ .slice(nextHasQuestion ? currentIndex + 2 : currentIndex + 1)
45
+ .reduce((joinedParams, currentParam) => {
46
+ if (currentParam.includes('#')) {
47
+ foundHash = true;
48
+ }
49
+ if (foundHash) {
50
+ return joinedParams.concat(currentParam);
51
+ }
52
+ else {
53
+ return [
54
+ joinedParams,
55
+ currentParam,
56
+ ].join('&');
57
+ }
58
+ }, '');
59
+ newEntry = [
60
+ currentEntry,
61
+ nextEntry,
62
+ subsequentSearchParams,
63
+ ].join('');
64
+ }
65
+ return fillingUpArray.concat(newEntry);
66
+ }, []);
23
67
  return [
24
68
  protocol,
25
69
  protocol ? protocolSplit : '',
@@ -16,7 +16,7 @@ export async function awaitedBlockingMap(input, callback) {
16
16
  return mappedValues;
17
17
  }
18
18
  export async function awaitedFilter(arrayInput, filterCallback, options) {
19
- const callbackResults = (options === null || options === void 0 ? void 0 : options.blocking)
19
+ const callbackResults = options?.blocking
20
20
  ? await awaitedBlockingMap(arrayInput, filterCallback)
21
21
  : await Promise.all(arrayInput.map(filterCallback));
22
22
  return arrayInput.filter((originalValue, index) => !!callbackResults[index]);
@@ -51,7 +51,6 @@ export function assertMatchesObjectShape(testThisOne, compareToThisOne, allowExt
51
51
  }
52
52
  }
53
53
  matchKeys.forEach((key) => {
54
- var _a;
55
54
  if (!typedHasProperty(testThisOne, key)) {
56
55
  throw new Error(`test object does not have key "${String(key)}" from expected shape.`);
57
56
  }
@@ -61,12 +60,11 @@ export function assertMatchesObjectShape(testThisOne, compareToThisOne, allowExt
61
60
  const testValue = testThisOne[key];
62
61
  const shouldMatch = compareToThisOne[key];
63
62
  if (!noCheckInnerValueOfTheseKeys[key]) {
64
- compareInnerValue(testValue, shouldMatch, throwKeyError, allowExtraProps, (_a = noCheckInnerValueOfTheseKeys[key]) !== null && _a !== void 0 ? _a : {});
63
+ compareInnerValue(testValue, shouldMatch, throwKeyError, allowExtraProps, noCheckInnerValueOfTheseKeys[key] ?? {});
65
64
  }
66
65
  });
67
66
  }
68
67
  function compareInnerValue(testValue, matchValue, throwKeyError, allowExtraProps, noCheckInnerValueOfTheseKeys) {
69
- var _a;
70
68
  const testType = typeof testValue;
71
69
  const shouldMatchType = typeof matchValue;
72
70
  if (testType !== shouldMatchType) {
@@ -76,7 +74,7 @@ function compareInnerValue(testValue, matchValue, throwKeyError, allowExtraProps
76
74
  if (typedHasProperty(matchValue, 'constructor')) {
77
75
  if (!typedHasProperty(testValue, 'constructor') ||
78
76
  testValue.constructor !== matchValue.constructor) {
79
- throwKeyError(`constructor "${(_a = testValue === null || testValue === void 0 ? void 0 : testValue.constructor) === null || _a === void 0 ? void 0 : _a.name}" did not match expected constructor "${matchValue.constructor}"`);
77
+ throwKeyError(`constructor "${testValue?.constructor?.name}" did not match expected constructor "${matchValue.constructor}"`);
80
78
  }
81
79
  }
82
80
  }
@@ -8,10 +8,11 @@ export function getObjectTypedKeys(input) {
8
8
  reflectKeys = Reflect.ownKeys(input);
9
9
  }
10
10
  catch (error) { }
11
- return (reflectKeys !== null && reflectKeys !== void 0 ? reflectKeys : [
12
- ...Object.keys(input),
13
- ...Object.getOwnPropertySymbols(input),
14
- ]);
11
+ return (reflectKeys ??
12
+ [
13
+ ...Object.keys(input),
14
+ ...Object.getOwnPropertySymbols(input),
15
+ ]);
15
16
  }
16
17
  export function getObjectTypedValues(input) {
17
18
  return getObjectTypedKeys(input).map((key) => input[key]);
@@ -10,5 +10,5 @@ export function addRegExpFlags(originalRegExp, flags) {
10
10
  }
11
11
  export function safeMatch(input, regExp) {
12
12
  const match = input.match(regExp);
13
- return match !== null && match !== void 0 ? match : [];
13
+ return match ?? [];
14
14
  }
@@ -1,7 +1,7 @@
1
1
  const protocolSplit = '://';
2
2
  /**
3
3
  * Joins all given arguments together as if they were parts of a URL. Preserves trailing slashes and
4
- * removes consecutive slashes in the path. This also encodes each part of the
4
+ * removes consecutive slashes in the path. This also encodes each URL part.
5
5
  *
6
6
  * @example: joinToUrl('https://example.com', 'path1', 'path2/', '/path3/') === 'https://example.com/path1/path2/path3/'
7
7
  */
@@ -13,10 +13,54 @@ export function joinUrlParts(...urlParts) {
13
13
  '',
14
14
  rawJoined,
15
15
  ];
16
+ let mapSearchParamsStarted = false;
17
+ let reduceSearchParamsStarted = false;
16
18
  const fixedRest = rawRest
17
19
  .replace(/\/{2,}/g, '/')
18
20
  .split('/')
19
- .map((part) => encodeURIComponent(part));
21
+ .map((part) => {
22
+ if (part.includes('?') || mapSearchParamsStarted) {
23
+ mapSearchParamsStarted = true;
24
+ return part;
25
+ }
26
+ else {
27
+ return encodeURIComponent(part);
28
+ }
29
+ })
30
+ .reduce((fillingUpArray, currentEntry, currentIndex, inputArray) => {
31
+ if (reduceSearchParamsStarted) {
32
+ return fillingUpArray;
33
+ }
34
+ const nextEntry = inputArray[currentIndex + 1];
35
+ let newEntry = currentEntry;
36
+ const nextHasQuestion = !currentEntry.includes('?') && nextEntry?.startsWith('?');
37
+ if (nextEntry?.startsWith('?') || nextHasQuestion) {
38
+ reduceSearchParamsStarted = true;
39
+ let foundHash = false;
40
+ const subsequentSearchParams = inputArray
41
+ .slice(nextHasQuestion ? currentIndex + 2 : currentIndex + 1)
42
+ .reduce((joinedParams, currentParam) => {
43
+ if (currentParam.includes('#')) {
44
+ foundHash = true;
45
+ }
46
+ if (foundHash) {
47
+ return joinedParams.concat(currentParam);
48
+ }
49
+ else {
50
+ return [
51
+ joinedParams,
52
+ currentParam,
53
+ ].join('&');
54
+ }
55
+ }, '');
56
+ newEntry = [
57
+ currentEntry,
58
+ nextEntry,
59
+ subsequentSearchParams,
60
+ ].join('');
61
+ }
62
+ return fillingUpArray.concat(newEntry);
63
+ }, []);
20
64
  return [
21
65
  protocol,
22
66
  protocol ? protocolSplit : '',
@@ -1,2 +1 @@
1
1
  export declare const ansiRegex: RegExp;
2
- //# sourceMappingURL=ansi.d.ts.map
@@ -11,4 +11,3 @@ export declare function typedMap<InputArrayGeneric extends ReadonlyArray<any>, O
11
11
  [Index in keyof InputArrayGeneric]: OutputType;
12
12
  };
13
13
  export {};
14
- //# sourceMappingURL=array.d.ts.map
@@ -12,4 +12,3 @@ export declare function awaitedFilter<OriginalGeneric>(arrayInput: ReadonlyArray
12
12
  */
13
13
  blocking?: boolean | undefined;
14
14
  }): Promise<OriginalGeneric[]>;
15
- //# sourceMappingURL=async.d.ts.map
@@ -23,4 +23,3 @@ export declare function ensureMinAndMax({ min, max }: {
23
23
  min: number;
24
24
  max: number;
25
25
  };
26
- //# sourceMappingURL=common-number.d.ts.map
@@ -42,4 +42,3 @@ export declare function getAllIndexesOf<IncludeLength extends boolean | undefine
42
42
  length: number;
43
43
  }[] : number[];
44
44
  export declare function typedSplit(input: string, splitString: string): AtLeastTuple<string, 1>;
45
- //# sourceMappingURL=common-string.d.ts.map
@@ -24,4 +24,3 @@ export declare function createDateFromNamedCommaFormat(commaFormatString: string
24
24
  * @param isoFormatString Should be a date in the format YYYY-MM-DD.
25
25
  */
26
26
  export declare function createDateFromUtcIsoFormat(isoFormatString: string): Date;
27
- //# sourceMappingURL=date.d.ts.map
@@ -9,4 +9,3 @@ export type RelativeDateCalculation = PartialAndUndefined<{
9
9
  years: number;
10
10
  }>;
11
11
  export declare function calculateRelativeDate(startingDate: Date | number | string, calculations: RelativeDateCalculation): Date;
12
- //# sourceMappingURL=relative-date.d.ts.map
@@ -1,2 +1 @@
1
1
  export declare function isBrowser(): boolean;
2
- //# sourceMappingURL=environment.d.ts.map
@@ -8,4 +8,3 @@ export declare function extractErrorMessage(error: unknown): string;
8
8
  export declare function ensureError(input: unknown): Error;
9
9
  export declare function executeAndReturnError<CallbackGeneric extends NoInputsFunction<PromiseLike<any>>>(callback: CallbackGeneric): Promise<Error | UnPromise<ReturnType<CallbackGeneric>>>;
10
10
  export declare function executeAndReturnError<CallbackGeneric extends NoInputsFunction>(callback: CallbackGeneric): Error | ReturnType<CallbackGeneric>;
11
- //# sourceMappingURL=error.d.ts.map
@@ -24,4 +24,3 @@ export type NoInputsFunction<ReturnGeneric = any> = () => ReturnGeneric;
24
24
  */
25
25
  export type TypedFunction<Arguments, Return> = Arguments extends readonly any[] ? number extends Arguments['length'] ? (...args: ArrayElement<Arguments>[]) => Return : (...args: Arguments) => Return : void extends Arguments ? () => Return : (arg: Arguments) => Return;
26
26
  export declare function isTruthy<T>(input: T): input is NonNullable<T>;
27
- //# sourceMappingURL=function.d.ts.map
@@ -20,4 +20,3 @@ export type JsonCompatibleArray = JsonCompatibleValue[]
20
20
  readonly [P in number]: JsonCompatibleValue;
21
21
  } & ReadonlyArray<any>);
22
22
  export type JsonCompatibleValue = JsonCompatiblePrimitiveValue | JsonCompatibleObject | JsonCompatibleArray;
23
- //# sourceMappingURL=json-compatible.d.ts.map
@@ -3,4 +3,3 @@ export declare function parseJson<ParsedJsonGeneric>({ jsonString, errorHandler,
3
3
  errorHandler?: (error: unknown) => never | ParsedJsonGeneric;
4
4
  shapeMatcher?: ParsedJsonGeneric;
5
5
  }): ParsedJsonGeneric;
6
- //# sourceMappingURL=json.d.ts.map
@@ -2,4 +2,3 @@ export declare function getEnumTypedKeys<T extends object>(input: T): (keyof T)[
2
2
  export declare function getEnumTypedValues<T extends object>(input: T): T[keyof T][];
3
3
  export declare function isEnumValue<T extends object>(input: unknown, checkEnum: T): input is T[keyof T];
4
4
  export declare function filterToEnumValues<T extends object>(inputs: ReadonlyArray<unknown>, checkEnum: T, caseInsensitive?: boolean): T[keyof T][];
5
- //# sourceMappingURL=enum.d.ts.map
@@ -2,4 +2,3 @@ import { PropertyValueType } from './object';
2
2
  export declare function filterObject<ObjectGeneric>(inputObject: ObjectGeneric, callback: (key: keyof ObjectGeneric, value: PropertyValueType<ObjectGeneric>, fullObject: ObjectGeneric) => boolean): Partial<ObjectGeneric>;
3
3
  export declare function omitObjectKeys<ObjectGeneric, KeyGeneric extends keyof ObjectGeneric>(inputObject: Readonly<ObjectGeneric>, omitTheseKeys: ReadonlyArray<KeyGeneric>): Omit<ObjectGeneric, KeyGeneric>;
4
4
  export declare function pickObjectKeys<ObjectGeneric, KeyGeneric extends keyof ObjectGeneric>(inputObject: Readonly<ObjectGeneric>, pickTheseKeys: ReadonlyArray<KeyGeneric>): Pick<ObjectGeneric, KeyGeneric>;
5
- //# sourceMappingURL=filter-object.d.ts.map
@@ -1,2 +1 @@
1
1
  export declare function hasKey<ParentType>(parent: ParentType, property: PropertyKey): property is keyof ParentType;
2
- //# sourceMappingURL=has-key.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { Jsonify } from 'type-fest';
2
2
  export declare function jsonify<InputGeneric>(input: InputGeneric): Jsonify<InputGeneric>;
3
- //# sourceMappingURL=jsonify.d.ts.map
@@ -22,4 +22,3 @@ export declare function mapObjectValuesSync<EntireInputGeneric extends object>(i
22
22
  * result of mapCallback for each property.
23
23
  */
24
24
  export declare function mapObjectValues<EntireInputGeneric extends object, MappedValueGeneric>(inputObject: EntireInputGeneric, mapCallback: (inputKey: keyof EntireInputGeneric, keyValue: EntireInputGeneric[typeof inputKey], fullObject: EntireInputGeneric) => MappedValueGeneric): MappedValues<EntireInputGeneric, MappedValueGeneric>;
25
- //# sourceMappingURL=map-object.d.ts.map
@@ -34,4 +34,3 @@ export type NestedBoolean<MatchObject extends object> = Partial<{
34
34
  * entries in that array.
35
35
  */
36
36
  export declare function assertMatchesObjectShape<MatchThisGeneric extends object = never>(testThisOne: unknown, compareToThisOne: NoInfer<ObjectWithAtLeastSingleEntryArrays<MatchThisGeneric>>, allowExtraProps?: boolean, noCheckInnerValueOfTheseKeys?: NestedBoolean<typeof compareToThisOne>): asserts testThisOne is MatchThisGeneric;
37
- //# sourceMappingURL=matches-object-shape.d.ts.map
@@ -9,4 +9,3 @@ export type NestedKeys<ObjectGeneric extends object> = UnionToIntersection<Extra
9
9
  ] : [keyof ObjectGeneric];
10
10
  export type NestedValue<ObjectGeneric extends object, NestedKeysGeneric extends NestedSequentialKeys<ObjectGeneric>> = NestedKeysGeneric extends readonly [infer FirstEntry, ...infer FollowingEntries] ? FirstEntry extends keyof ObjectGeneric ? FollowingEntries extends never[] ? ObjectGeneric[FirstEntry] : ObjectGeneric[FirstEntry] extends object ? FollowingEntries extends NestedSequentialKeys<ObjectGeneric[FirstEntry]> ? NestedValue<ObjectGeneric[FirstEntry], FollowingEntries> : never : never : never : never;
11
11
  export declare function getValueFromNestedKeys<ObjectGeneric extends object, KeysGeneric extends NestedSequentialKeys<ObjectGeneric>>(inputObject: ObjectGeneric, nestedKeys: KeysGeneric): NestedValue<ObjectGeneric, KeysGeneric> | undefined;
12
- //# sourceMappingURL=nested-keys.d.ts.map
@@ -3,4 +3,3 @@ export declare function getObjectTypedKeys<ObjectGeneric extends unknown>(input:
3
3
  export declare function getObjectTypedValues<ObjectGeneric extends unknown>(input: ObjectGeneric): ObjectGeneric[keyof ObjectGeneric][];
4
4
  export declare function getEntriesSortedByKey(input: object): [string, unknown][];
5
5
  export declare function typedObjectFromEntries<KeyType extends PropertyKey, ValueType>(entries: ReadonlyArray<Readonly<[KeyType, ValueType]>>): Record<KeyType, ValueType>;
6
- //# sourceMappingURL=object-entries.d.ts.map
@@ -10,4 +10,3 @@ export declare function areJsonEqual(a: Readonly<JsonCompatibleValue | undefined
10
10
  /** The input here must be serializable otherwise JSON parsing errors will be thrown */
11
11
  export declare function copyThroughJson<T>(input: T): T;
12
12
  export type PropertyValueType<T> = T[keyof T];
13
- //# sourceMappingURL=object.d.ts.map
@@ -5,4 +5,3 @@ type InnerPickDeep<OriginalObjectGeneric extends object, DeepKeys extends any[]>
5
5
  } : DeepKeys extends [infer CurrentLevelPick] ? CurrentLevelPick extends keyof OriginalObjectGeneric ? Pick<OriginalObjectGeneric, CurrentLevelPick> : never : never>;
6
6
  export type PickDeep<OriginalObjectGeneric extends object, DeepKeys extends NestedKeys<OriginalObjectGeneric>> = InnerPickDeep<OriginalObjectGeneric, DeepKeys>;
7
7
  export {};
8
- //# sourceMappingURL=pick-deep.d.ts.map
@@ -5,4 +5,3 @@ type CombineTypeWithKey<KeyGeneric extends PropertyKey, ParentGeneric> = ParentG
5
5
  export declare function typedHasProperty<KeyGeneric extends PropertyKey, ParentGeneric>(inputObject: ParentGeneric, inputKey: KeyGeneric): inputObject is CombineTypeWithKey<KeyGeneric, ParentGeneric>;
6
6
  export declare function typedHasProperties<KeyGeneric extends PropertyKey, ParentGeneric>(inputObject: ParentGeneric, inputKeys: ReadonlyArray<KeyGeneric>): inputObject is CombineTypeWithKey<KeyGeneric, ParentGeneric>;
7
7
  export {};
8
- //# sourceMappingURL=typed-has-property.d.ts.map
@@ -25,4 +25,3 @@ export type WaitForConditionInputs = {
25
25
  timeoutMessage?: string;
26
26
  };
27
27
  export declare function waitForCondition({ conditionCallback, timeoutMs, intervalMs, timeoutMessage, }: WaitForConditionInputs): Promise<void>;
28
- //# sourceMappingURL=promise.d.ts.map
@@ -1,4 +1,3 @@
1
1
  export declare function deDupeRegExFlags(flags: string): string;
2
2
  export declare function addRegExpFlags(originalRegExp: RegExp, flags: string): RegExp;
3
3
  export declare function safeMatch(input: string, regExp: RegExp): string[];
4
- //# sourceMappingURL=regexp.d.ts.map
@@ -17,4 +17,3 @@ export declare function getRuntimeTypeOf(input: unknown): RuntimeTypeOf;
17
17
  export declare function isRuntimeTypeOf<T extends RuntimeTypeOf>(input: unknown, testType: T): input is RuntimeTypeOfMapping[T];
18
18
  export declare function assertRuntimeTypeOf<T extends RuntimeTypeOf>(input: unknown, testType: T, inputName: string): asserts input is RuntimeTypeOfMapping[T];
19
19
  export {};
20
- //# sourceMappingURL=runtime-type-of.d.ts.map
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * Joins all given arguments together as if they were parts of a URL. Preserves trailing slashes and
3
- * removes consecutive slashes in the path. This also encodes each part of the
3
+ * removes consecutive slashes in the path. This also encodes each URL part.
4
4
  *
5
5
  * @example: joinToUrl('https://example.com', 'path1', 'path2/', '/path3/') === 'https://example.com/path1/path2/path3/'
6
6
  */
7
7
  export declare function joinUrlParts(...urlParts: ReadonlyArray<string>): string;
8
- //# sourceMappingURL=url.d.ts.map
@@ -1,2 +1 @@
1
1
  export declare function isUuid(maybeUuid: string): boolean;
2
- //# sourceMappingURL=uuid.d.ts.map
@@ -17,4 +17,3 @@ export declare function truncateNumber(originalValue: Readonly<unknown>, { custo
17
17
  customSuffixes: ReadonlyArray<string> | undefined;
18
18
  maxLength: number | undefined;
19
19
  }>): string;
20
- //# sourceMappingURL=truncate-number.d.ts.map
@@ -6,4 +6,3 @@ export type AtLeastTuple<ArrayElementGeneric, LengthGeneric extends number> = re
6
6
  ];
7
7
  export declare function isLengthAtLeast<ArrayElementGeneric, LengthGeneric extends number>(array: ReadonlyArray<ArrayElementGeneric | undefined>, length: LengthGeneric): array is AtLeastTuple<ArrayElementGeneric, LengthGeneric>;
8
8
  export {};
9
- //# sourceMappingURL=tuple.d.ts.map
@@ -57,4 +57,3 @@ export type NoInfer<T> = [T][T extends any ? 0 : never];
57
57
  * input.
58
58
  */
59
59
  export declare function ensureType<ExpectedType = never>(input: NoInfer<ExpectedType>): NoInfer<ExpectedType>;
60
- //# sourceMappingURL=type.d.ts.map
@@ -29,4 +29,3 @@ export * from './augments/string/uuid';
29
29
  export * from './augments/truncate-number';
30
30
  export * from './augments/tuple';
31
31
  export * from './augments/type';
32
- //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/common",
3
- "version": "13.2.0",
3
+ "version": "13.2.2",
4
4
  "homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common",
5
5
  "bugs": {
6
6
  "url": "https://github.com/electrovir/augment-vir/issues"
@@ -18,16 +18,16 @@
18
18
  "module": "dist/esm/index.js",
19
19
  "types": "dist/types/index.d.ts",
20
20
  "scripts": {
21
- "compile": "tsc --project tsconfig.json && tsc --project tsconfig.cjs.json && tsc --project tsconfig.esm.json",
21
+ "compile": "tsc --project tsconfig.json && tsc --project tsconfig.cjs.json",
22
22
  "test": "echo \"use common-test to run tests\" && exit 0",
23
23
  "test:coverage": "npm test",
24
24
  "test:types": "tsc --noEmit"
25
25
  },
26
26
  "dependencies": {
27
- "type-fest": "^3.6.1"
27
+ "type-fest": "^3.7.2"
28
28
  },
29
29
  "devDependencies": {
30
- "typescript": "^4.9.5"
30
+ "typescript": "^5.0.2"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
@@ -1,2 +0,0 @@
1
- export declare const ansiRegex: RegExp;
2
- //# sourceMappingURL=ansi.d.ts.map
@@ -1,14 +0,0 @@
1
- import { AtLeastTuple } from './tuple';
2
- import { ArrayElement } from './type';
3
- export declare function filterOutIndexes<T>(array: ReadonlyArray<T>, indexes: ReadonlyArray<number>): T[];
4
- export declare function flatten2dArray<T>(array2d: ReadonlyArray<ReadonlyArray<T>>): T[];
5
- export type AtLeastOneEntryArray<ArrayGeneric extends ReadonlyArray<any>> = AtLeastTuple<ArrayElement<ArrayGeneric>, 1>;
6
- export declare function trimArrayStrings(input: ReadonlyArray<string>): string[];
7
- export declare function typedArrayIncludes<T>(array: ReadonlyArray<T>, input: unknown): input is T;
8
- type MapCallbackType<ArrayType extends ReadonlyArray<any>, OutputType> = (value: ArrayElement<ArrayType>, index: number, array: ArrayType) => OutputType;
9
- /** Preserves tuple types. */
10
- export declare function typedMap<InputArrayGeneric extends ReadonlyArray<any>, OutputType>(arrayToMap: InputArrayGeneric, mapCallback: MapCallbackType<InputArrayGeneric, OutputType>): {
11
- [Index in keyof InputArrayGeneric]: OutputType;
12
- };
13
- export {};
14
- //# sourceMappingURL=array.d.ts.map
@@ -1,15 +0,0 @@
1
- /**
2
- * Acts like calling Array.prototype.forEach in that all elements are executed upon in order, and
3
- * each execution is blocking. Meaning, the callback won't be called on element 2 until the callback
4
- * has finished its call on element 1.
5
- */
6
- export declare function awaitedForEach<OriginalGeneric>(input: ReadonlyArray<OriginalGeneric>, callback: (arrayElement: OriginalGeneric, index: number, wholeArray: ReadonlyArray<OriginalGeneric>) => void | PromiseLike<void>): Promise<void>;
7
- export declare function awaitedBlockingMap<OriginalGeneric, MappedGeneric>(input: ReadonlyArray<OriginalGeneric>, callback: (arrayElement: OriginalGeneric, index: number, wholeArray: ReadonlyArray<OriginalGeneric>) => MappedGeneric | PromiseLike<MappedGeneric>): Promise<Awaited<MappedGeneric>[]>;
8
- export declare function awaitedFilter<OriginalGeneric>(arrayInput: ReadonlyArray<OriginalGeneric>, filterCallback: (arrayElement: OriginalGeneric, index: number, wholeArray: ReadonlyArray<OriginalGeneric>) => Promise<unknown>, options?: {
9
- /**
10
- * Each call to the filter callback is blocking, meaning the next one won't start until the
11
- * current one finishes. By default this is false.
12
- */
13
- blocking?: boolean | undefined;
14
- }): Promise<OriginalGeneric[]>;
15
- //# sourceMappingURL=async.d.ts.map
@@ -1,26 +0,0 @@
1
- export declare const NaNString: string;
2
- export declare function addCommasToNumber(input: number | string): string;
3
- export declare function clamp(
4
- /**
5
- * This uses a destructured object so that consumers cannot get confused as to which input is
6
- * which (which would be easy to do since they're all of the same type).
7
- */
8
- { value, min, max, }: {
9
- value: number;
10
- min: number;
11
- max: number;
12
- }): number;
13
- export declare function convertIntoNumber(input: unknown): number;
14
- export declare function doesRequireScientificNotation(input: number): boolean;
15
- /**
16
- * Given a min and max, ensures that they are in correct order. Meaning, min is less than max. If
17
- * that is not the case, the returned value is the given min and max values swapped.
18
- */
19
- export declare function ensureMinAndMax({ min, max }: {
20
- min: number;
21
- max: number;
22
- }): {
23
- min: number;
24
- max: number;
25
- };
26
- //# sourceMappingURL=common-number.d.ts.map
@@ -1,45 +0,0 @@
1
- import { AtLeastTuple } from './tuple';
2
- /**
3
- * Join elements into a string with commas separating each value. Add a conjunction before the final
4
- * item in the list. If the array has a length < 2, the conjunction is not added. If the list is
5
- * only of length 2, then no commas are added.
6
- *
7
- * @param list Array of items to be converted into strings. Works best if these are simply strings
8
- * to begin with.
9
- * @param conjunction Defaults to 'and'. The conjunction to be used before the final element.
10
- */
11
- export declare function joinWithFinalConjunction(list: ReadonlyArray<any>, conjunction?: string): string;
12
- export declare function removeAnsiEscapeCodes(input: string): string;
13
- export declare const removeColor: typeof removeAnsiEscapeCodes;
14
- export declare function removeCommasFromNumberString(numberString: string): string;
15
- /** Collapse all consecutive white space into just one space and trim surrounding whitespace. */
16
- export declare function collapseWhiteSpace(input: string): string;
17
- /** Same as String.prototype.split but includes the delimiter to split by in the output array. */
18
- export declare function splitIncludeSplit(original: string, splitterInput: string | RegExp, caseSensitive: boolean): readonly string[];
19
- export type CasingOptions = {
20
- capitalizeFirstLetter: boolean;
21
- };
22
- export declare function capitalizeFirstLetter<InputGeneric extends string>(input: InputGeneric): Capitalize<InputGeneric>;
23
- export declare function kebabCaseToCamelCase(rawKebabCase: string, casingOptions?: Partial<CasingOptions> | undefined): string;
24
- export declare function camelCaseToKebabCase(rawCamelCase: string): string;
25
- export declare function replaceStringAtIndex(originalString: string, start: number, newString: string, length?: number): string;
26
- /**
27
- * Escapes characters from the given string so that it can be used within a RegExp without being
28
- * parsed as RegExp syntax.
29
- */
30
- export declare function escapeStringForRegExp(input: string): string;
31
- export declare function getAllIndexesOf<IncludeLength extends boolean | undefined>({ searchIn, searchFor, caseSensitive, includeLength, }: {
32
- searchIn: string;
33
- searchFor: string | RegExp;
34
- /**
35
- * CaseSensitive only applies when the input is a string. Otherwise, the RegExp's "i" flag is
36
- * used to determine case sensitivity.
37
- */
38
- caseSensitive: boolean;
39
- includeLength?: IncludeLength;
40
- }): IncludeLength extends true ? {
41
- index: number;
42
- length: number;
43
- }[] : number[];
44
- export declare function typedSplit(input: string, splitString: string): AtLeastTuple<string, 1>;
45
- //# sourceMappingURL=common-string.d.ts.map