@@ -3354,6 +3354,147 @@ export interface IAssertClass<AssertInst extends IAssertInst = IAssertInst> {
33543354 * ```
33553355 */
33563356 decreasesButNotBy < T > ( fn : ( ) => void , target : T , prop : keyof T , delta : number , initMsg ?: MsgSource ) : AssertInst ;
3357+
3358+ /**
3359+ * Asserts that the target has any of the specified keys using deep equality comparison.
3360+ * This method checks if at least one of the given keys exists in the target using deep equality
3361+ * for key comparison. Particularly useful for Maps and Sets where keys may be objects.
3362+ *
3363+ * @param target - The object, Map, or Set to check for keys.
3364+ * @param keys - The keys to search for (can be individual arguments or an array of keys).
3365+ * @param initMsg - The message to display if the assertion fails.
3366+ * @asserts That the `target` has at least one of the specified keys and throws {@link AssertionFailure} if it does not.
3367+ * @since 0.1.5
3368+ * @example
3369+ * ```typescript
3370+ * const obj = { greeting: "hello", subject: "friend" };
3371+ * assert.hasAnyDeepKeys(obj, "greeting", "message"); // Passes - has "greeting"
3372+ * assert.hasAnyDeepKeys(obj, ["greeting", "message"]); // Passes - has "greeting"
3373+ *
3374+ * const map = new Map([[{ id: 1 }, "value1"], [{ id: 2 }, "value2"]]);
3375+ * assert.hasAnyDeepKeys(map, { id: 1 }); // Passes - deep key match
3376+ * assert.hasAnyDeepKeys(map, { id: 1 }, { id: 3 }); // Passes - has { id: 1 }
3377+ * assert.hasAnyDeepKeys(obj, "unknown", "missing"); // Throws AssertionFailure
3378+ * ```
3379+ */
3380+ hasAnyDeepKeys ( target : any , ...keys : any [ ] ) : AssertInst ;
3381+
3382+ /**
3383+ * Asserts that the target has all of the specified keys using deep equality comparison.
3384+ * This method checks if all of the given keys exist in the target using deep equality
3385+ * for key comparison. Particularly useful for Maps and Sets where keys may be objects.
3386+ *
3387+ * @param target - The object, Map, or Set to check for keys.
3388+ * @param keys - The keys to search for (can be individual arguments or an array of keys).
3389+ * @param initMsg - The message to display if the assertion fails.
3390+ * @asserts That the `target` has all of the specified keys and throws {@link AssertionFailure} if it does not.
3391+ * @since 0.1.5
3392+ * @example
3393+ * ```typescript
3394+ * const obj = { greeting: "hello", subject: "friend", message: "darkness" };
3395+ * assert.hasAllDeepKeys(obj, "greeting", "subject"); // Passes - has both keys
3396+ * assert.hasAllDeepKeys(obj, ["greeting", "subject"]); // Passes - has both keys
3397+ *
3398+ * const map = new Map([[{ id: 1 }, "value1"], [{ id: 2 }, "value2"]]);
3399+ * assert.hasAllDeepKeys(map, { id: 1 }, { id: 2 }); // Passes - has both keys
3400+ * assert.hasAllDeepKeys(obj, "greeting", "unknown"); // Throws AssertionFailure - missing "unknown"
3401+ * ```
3402+ */
3403+ hasAllDeepKeys ( target : any , ...keys : any [ ] ) : AssertInst ;
3404+
3405+ /**
3406+ * Asserts that the target does NOT have any of the specified keys using deep equality comparison.
3407+ * This method checks that none of the given keys exist in the target using deep equality
3408+ * for key comparison. This is the inverse of {@link hasAnyDeepKeys}.
3409+ *
3410+ * @param target - The object, Map, or Set to check for keys.
3411+ * @param keys - The keys to search for (can be individual arguments or an array of keys).
3412+ * @param initMsg - The message to display if the assertion fails.
3413+ * @asserts That the `target` does not have any of the specified keys and throws {@link AssertionFailure} if it does.
3414+ * @since 0.1.5
3415+ * @example
3416+ * ```typescript
3417+ * const obj = { greeting: "hello", subject: "friend" };
3418+ * assert.notHaveAnyDeepKeys(obj, "unknown", "missing"); // Passes - has neither key
3419+ * assert.notHaveAnyDeepKeys(obj, ["unknown", "missing"]); // Passes - has neither key
3420+ *
3421+ * const map = new Map([[{ id: 1 }, "value1"]]);
3422+ * assert.notHaveAnyDeepKeys(map, { id: 3 }, { id: 4 }); // Passes - has neither key
3423+ * assert.notHaveAnyDeepKeys(obj, "greeting", "unknown"); // Throws AssertionFailure - has "greeting"
3424+ * ```
3425+ */
3426+ notHaveAnyDeepKeys ( target : any , ...keys : any [ ] ) : AssertInst ;
3427+
3428+ /**
3429+ * Asserts that the target does NOT have any of the specified keys using deep equality comparison.
3430+ * This method checks that none of the given keys exist in the target using deep equality
3431+ * for key comparison. This is the inverse of {@link hasAnyDeepKeys}.
3432+ *
3433+ * @param target - The object, Map, or Set to check for keys.
3434+ * @param keys - The keys to search for (can be individual arguments or an array of keys).
3435+ * @param initMsg - The message to display if the assertion fails.
3436+ * @asserts That the `target` does not have any of the specified keys and throws {@link AssertionFailure} if it does.
3437+ * @alias notHaveAnyDeepKeys
3438+ * @since 0.1.5
3439+ * @example
3440+ * ```typescript
3441+ * const obj = { greeting: "hello", subject: "friend" };
3442+ * assert.doesNotHaveAnyDeepKeys(obj, "unknown", "missing"); // Passes - has neither key
3443+ * assert.doesNotHaveAnyDeepKeys(obj, ["unknown", "missing"]); // Passes - has neither key
3444+ *
3445+ * const map = new Map([[{ id: 1 }, "value1"]]);
3446+ * assert.doesNotHaveAnyDeepKeys(map, { id: 3 }, { id: 4 }); // Passes - has neither key
3447+ * assert.doesNotHaveAnyDeepKeys(obj, "greeting", "unknown"); // Throws AssertionFailure - has "greeting"
3448+ * ```
3449+ */
3450+ doesNotHaveAnyDeepKeys ( target : any , ...keys : any [ ] ) : AssertInst ;
3451+
3452+ /**
3453+ * Asserts that the target does NOT have all of the specified keys using deep equality comparison.
3454+ * This method checks that at least one of the given keys does not exist in the target using deep equality
3455+ * for key comparison. This is the inverse of {@link hasAllDeepKeys}.
3456+ *
3457+ * @param target - The object, Map, or Set to check for keys.
3458+ * @param keys - The keys to search for (can be individual arguments or an array of keys).
3459+ * @param initMsg - The message to display if the assertion fails.
3460+ * @asserts That the `target` does not have all of the specified keys and throws {@link AssertionFailure} if it does.
3461+ * @since 0.1.5
3462+ * @example
3463+ * ```typescript
3464+ * const obj = { greeting: "hello", subject: "friend" };
3465+ * assert.notHaveAllDeepKeys(obj, "greeting", "unknown"); // Passes - missing "unknown"
3466+ * assert.notHaveAllDeepKeys(obj, ["greeting", "unknown"]); // Passes - missing "unknown"
3467+ *
3468+ * const map = new Map([[{ id: 1 }, "value1"]]);
3469+ * assert.notHaveAllDeepKeys(map, { id: 1 }, { id: 2 }); // Passes - missing { id: 2 }
3470+ * assert.notHaveAllDeepKeys(obj, "greeting", "subject"); // Throws AssertionFailure - has both keys
3471+ * ```
3472+ */
3473+ notHaveAllDeepKeys ( target : any , ...keys : any [ ] ) : AssertInst ;
3474+
3475+ /**
3476+ * Asserts that the target does NOT have all of the specified keys using deep equality comparison.
3477+ * This method checks that at least one of the given keys does not exist in the target using deep equality
3478+ * for key comparison. This is the inverse of {@link hasAllDeepKeys}.
3479+ *
3480+ * @param target - The object, Map, or Set to check for keys.
3481+ * @param keys - The keys to search for (can be individual arguments or an array of keys).
3482+ * @param initMsg - The message to display if the assertion fails.
3483+ * @asserts That the `target` does not have all of the specified keys and throws {@link AssertionFailure} if it does.
3484+ * @alias notHaveAllDeepKeys
3485+ * @since 0.1.5
3486+ * @example
3487+ * ```typescript
3488+ * const obj = { greeting: "hello", subject: "friend" };
3489+ * assert.doesNotHaveAllDeepKeys(obj, "greeting", "unknown"); // Passes - missing "unknown"
3490+ * assert.doesNotHaveAllDeepKeys(obj, ["greeting", "unknown"]); // Passes - missing "unknown"
3491+ *
3492+ * const map = new Map([[{ id: 1 }, "value1"]]);
3493+ * assert.doesNotHaveAllDeepKeys(map, { id: 1 }, { id: 2 }); // Passes - missing { id: 2 }
3494+ * assert.doesNotHaveAllDeepKeys(obj, "greeting", "subject"); // Throws AssertionFailure - has both keys
3495+ * ```
3496+ */
3497+ doesNotHaveAllDeepKeys ( target : any , ...keys : any [ ] ) : AssertInst ;
33573498}
33583499
33593500export type IExtendedAssert < T = any > = IAssertClass < IAssertInst & T > & T ;
0 commit comments