@augment-vir/common 6.1.1 → 6.1.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.
|
@@ -58,7 +58,7 @@ export type ObjectWithAtLeastSingleEntryArrays<BaseObject extends object> = {
|
|
|
58
58
|
* that exists. If more array values are present, they will be considered other possible types for
|
|
59
59
|
* entries in that array.
|
|
60
60
|
*/
|
|
61
|
-
export declare function assertMatchesObjectShape<MatchThisGeneric extends object = never>(testThisOne: unknown, compareToThisOne: NoInfer<ObjectWithAtLeastSingleEntryArrays<MatchThisGeneric>>, allowExtraProps?: boolean): asserts testThisOne is MatchThisGeneric;
|
|
61
|
+
export declare function assertMatchesObjectShape<MatchThisGeneric extends object = never>(testThisOne: unknown, compareToThisOne: NoInfer<ObjectWithAtLeastSingleEntryArrays<MatchThisGeneric>>, allowExtraProps?: boolean, noCheckInnerValueOfTheseKeys?: Partial<Record<keyof typeof compareToThisOne, boolean>>): asserts testThisOne is MatchThisGeneric;
|
|
62
62
|
export declare function typedObjectFromEntries<KeyType extends PropertyKey, ValueType>(entries: ReadonlyArray<Readonly<[KeyType, ValueType]>>): Record<KeyType, ValueType>;
|
|
63
63
|
export {};
|
|
64
64
|
//# sourceMappingURL=object.d.ts.map
|
|
@@ -199,7 +199,7 @@ exports.matchesObjectShape = matchesObjectShape;
|
|
|
199
199
|
* that exists. If more array values are present, they will be considered other possible types for
|
|
200
200
|
* entries in that array.
|
|
201
201
|
*/
|
|
202
|
-
function assertMatchesObjectShape(testThisOne, compareToThisOne, allowExtraProps = false) {
|
|
202
|
+
function assertMatchesObjectShape(testThisOne, compareToThisOne, allowExtraProps = false, noCheckInnerValueOfTheseKeys = {}) {
|
|
203
203
|
const testKeys = getObjectTypedKeys(testThisOne);
|
|
204
204
|
const matchKeys = new Set(getObjectTypedKeys(compareToThisOne));
|
|
205
205
|
if (!allowExtraProps) {
|
|
@@ -217,11 +217,13 @@ function assertMatchesObjectShape(testThisOne, compareToThisOne, allowExtraProps
|
|
|
217
217
|
}
|
|
218
218
|
const testValue = testThisOne[key];
|
|
219
219
|
const shouldMatch = compareToThisOne[key];
|
|
220
|
-
|
|
220
|
+
if (!noCheckInnerValueOfTheseKeys[key]) {
|
|
221
|
+
compareInnerValue(testValue, shouldMatch, throwKeyError, allowExtraProps);
|
|
222
|
+
}
|
|
221
223
|
});
|
|
222
224
|
}
|
|
223
225
|
exports.assertMatchesObjectShape = assertMatchesObjectShape;
|
|
224
|
-
function compareInnerValue(testValue, matchValue, throwKeyError) {
|
|
226
|
+
function compareInnerValue(testValue, matchValue, throwKeyError, allowExtraProps) {
|
|
225
227
|
var _a;
|
|
226
228
|
const testType = typeof testValue;
|
|
227
229
|
const shouldMatchType = typeof matchValue;
|
|
@@ -250,7 +252,7 @@ function compareInnerValue(testValue, matchValue, throwKeyError) {
|
|
|
250
252
|
const errors = matchValue
|
|
251
253
|
.map((matchValue) => {
|
|
252
254
|
try {
|
|
253
|
-
compareInnerValue(testValueEntry, matchValue, throwKeyError);
|
|
255
|
+
compareInnerValue(testValueEntry, matchValue, throwKeyError, allowExtraProps);
|
|
254
256
|
return undefined;
|
|
255
257
|
}
|
|
256
258
|
catch (error) {
|
|
@@ -264,7 +266,7 @@ function compareInnerValue(testValue, matchValue, throwKeyError) {
|
|
|
264
266
|
});
|
|
265
267
|
}
|
|
266
268
|
else if (isObject(matchValue)) {
|
|
267
|
-
assertMatchesObjectShape(testValue, matchValue);
|
|
269
|
+
assertMatchesObjectShape(testValue, matchValue, allowExtraProps);
|
|
268
270
|
}
|
|
269
271
|
}
|
|
270
272
|
function typedObjectFromEntries(entries) {
|
|
@@ -58,7 +58,7 @@ export type ObjectWithAtLeastSingleEntryArrays<BaseObject extends object> = {
|
|
|
58
58
|
* that exists. If more array values are present, they will be considered other possible types for
|
|
59
59
|
* entries in that array.
|
|
60
60
|
*/
|
|
61
|
-
export declare function assertMatchesObjectShape<MatchThisGeneric extends object = never>(testThisOne: unknown, compareToThisOne: NoInfer<ObjectWithAtLeastSingleEntryArrays<MatchThisGeneric>>, allowExtraProps?: boolean): asserts testThisOne is MatchThisGeneric;
|
|
61
|
+
export declare function assertMatchesObjectShape<MatchThisGeneric extends object = never>(testThisOne: unknown, compareToThisOne: NoInfer<ObjectWithAtLeastSingleEntryArrays<MatchThisGeneric>>, allowExtraProps?: boolean, noCheckInnerValueOfTheseKeys?: Partial<Record<keyof typeof compareToThisOne, boolean>>): asserts testThisOne is MatchThisGeneric;
|
|
62
62
|
export declare function typedObjectFromEntries<KeyType extends PropertyKey, ValueType>(entries: ReadonlyArray<Readonly<[KeyType, ValueType]>>): Record<KeyType, ValueType>;
|
|
63
63
|
export {};
|
|
64
64
|
//# sourceMappingURL=object.d.ts.map
|
|
@@ -180,7 +180,7 @@ export function matchesObjectShape(testThisOne, compareToThisOne, allowExtraProp
|
|
|
180
180
|
* that exists. If more array values are present, they will be considered other possible types for
|
|
181
181
|
* entries in that array.
|
|
182
182
|
*/
|
|
183
|
-
export function assertMatchesObjectShape(testThisOne, compareToThisOne, allowExtraProps = false) {
|
|
183
|
+
export function assertMatchesObjectShape(testThisOne, compareToThisOne, allowExtraProps = false, noCheckInnerValueOfTheseKeys = {}) {
|
|
184
184
|
const testKeys = getObjectTypedKeys(testThisOne);
|
|
185
185
|
const matchKeys = new Set(getObjectTypedKeys(compareToThisOne));
|
|
186
186
|
if (!allowExtraProps) {
|
|
@@ -198,10 +198,12 @@ export function assertMatchesObjectShape(testThisOne, compareToThisOne, allowExt
|
|
|
198
198
|
}
|
|
199
199
|
const testValue = testThisOne[key];
|
|
200
200
|
const shouldMatch = compareToThisOne[key];
|
|
201
|
-
|
|
201
|
+
if (!noCheckInnerValueOfTheseKeys[key]) {
|
|
202
|
+
compareInnerValue(testValue, shouldMatch, throwKeyError, allowExtraProps);
|
|
203
|
+
}
|
|
202
204
|
});
|
|
203
205
|
}
|
|
204
|
-
function compareInnerValue(testValue, matchValue, throwKeyError) {
|
|
206
|
+
function compareInnerValue(testValue, matchValue, throwKeyError, allowExtraProps) {
|
|
205
207
|
var _a;
|
|
206
208
|
const testType = typeof testValue;
|
|
207
209
|
const shouldMatchType = typeof matchValue;
|
|
@@ -230,7 +232,7 @@ function compareInnerValue(testValue, matchValue, throwKeyError) {
|
|
|
230
232
|
const errors = matchValue
|
|
231
233
|
.map((matchValue) => {
|
|
232
234
|
try {
|
|
233
|
-
compareInnerValue(testValueEntry, matchValue, throwKeyError);
|
|
235
|
+
compareInnerValue(testValueEntry, matchValue, throwKeyError, allowExtraProps);
|
|
234
236
|
return undefined;
|
|
235
237
|
}
|
|
236
238
|
catch (error) {
|
|
@@ -244,7 +246,7 @@ function compareInnerValue(testValue, matchValue, throwKeyError) {
|
|
|
244
246
|
});
|
|
245
247
|
}
|
|
246
248
|
else if (isObject(matchValue)) {
|
|
247
|
-
assertMatchesObjectShape(testValue, matchValue);
|
|
249
|
+
assertMatchesObjectShape(testValue, matchValue, allowExtraProps);
|
|
248
250
|
}
|
|
249
251
|
}
|
|
250
252
|
export function typedObjectFromEntries(entries) {
|
|
@@ -58,7 +58,7 @@ export type ObjectWithAtLeastSingleEntryArrays<BaseObject extends object> = {
|
|
|
58
58
|
* that exists. If more array values are present, they will be considered other possible types for
|
|
59
59
|
* entries in that array.
|
|
60
60
|
*/
|
|
61
|
-
export declare function assertMatchesObjectShape<MatchThisGeneric extends object = never>(testThisOne: unknown, compareToThisOne: NoInfer<ObjectWithAtLeastSingleEntryArrays<MatchThisGeneric>>, allowExtraProps?: boolean): asserts testThisOne is MatchThisGeneric;
|
|
61
|
+
export declare function assertMatchesObjectShape<MatchThisGeneric extends object = never>(testThisOne: unknown, compareToThisOne: NoInfer<ObjectWithAtLeastSingleEntryArrays<MatchThisGeneric>>, allowExtraProps?: boolean, noCheckInnerValueOfTheseKeys?: Partial<Record<keyof typeof compareToThisOne, boolean>>): asserts testThisOne is MatchThisGeneric;
|
|
62
62
|
export declare function typedObjectFromEntries<KeyType extends PropertyKey, ValueType>(entries: ReadonlyArray<Readonly<[KeyType, ValueType]>>): Record<KeyType, ValueType>;
|
|
63
63
|
export {};
|
|
64
64
|
//# sourceMappingURL=object.d.ts.map
|