Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions assert/equal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,18 @@ function sameValueZero(a: unknown, b: unknown) {
/**
* Deep equality comparison used in assertions.
*
* This function is based on value equality, but for some cases (such as data
* that can only be read asynchronously or function properties) value equality
* is not possible to determine. In such cases, reference equality is used
* instead, which may cause false negatives for objects such as `Blob`s or
* `Request`s.
*
* @param a The actual value
* @param b The expected value
* @returns `true` if the values are deeply equal, `false` otherwise
*
* @throws {TypeError} If either value is a `WeakMap` or `WeakSet`.
*
* @example Usage
* ```ts
* import { equal } from "@std/assert/equal";
Expand Down
8 changes: 5 additions & 3 deletions assert/equals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import { AssertionError } from "./assertion_error.ts";
* Type parameter can be specified to ensure values under comparison have the
* same type.
*
* Note: When comparing `Blob` objects, you should first convert them to
* `Uint8Array` using the `Blob.bytes()` method and then compare their
* contents.
* Note: This function is based on value equality, but for some cases (such as
* data that can only be read asynchronously or function properties) value
* equality is not possible to determine. In such cases, reference equality is
* used instead, which may cause false negatives for objects such as `Blob`s or
* `Request`s.
*
* @example Usage
* ```ts ignore
Expand Down
6 changes: 6 additions & 0 deletions assert/not_equals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import { format } from "@std/internal/format";
*
* Type parameter can be specified to ensure values under comparison have the same type.
*
* Note: This function is based on value equality, but for some cases (such as
* data that can only be read asynchronously or function properties) value
* equality is not possible to determine. In such cases, reference equality is
* used instead, which may cause false negatives for objects such as `Blob`s or
* `Request`s.
*
* @example Usage
* ```ts ignore
* import { assertNotEquals } from "@std/assert";
Expand Down
Loading