Skip to content

Commit fe480b6

Browse files
committed
Improve documentation
1 parent ca5153b commit fe480b6

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/index.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import * as colorette from "colorette"
22
import * as diff from "diff"
33

44
/**
5-
* Checks the two given strings character-by-character for equality.
6-
* If there are any differences, it throws an exception with a Bash-colored diff as the error message.
5+
* Asserts that two blocks of text are equal, comparing character by character.
6+
*
7+
* @throws a bash-colored error if the arguments are not equal
78
*/
89
export function chars(
910
actual: string,
@@ -23,8 +24,10 @@ export function chars(
2324
}
2425

2526
/**
26-
* Checks the two given Objects for equality.
27-
* If there are any differences, it throws an exception with a Bash-colored diff as the error message.
27+
* Diffs two JSON objects, comparing the fields defined on each.
28+
* The order of fields, etc does not matter.
29+
*
30+
* @throws a bash-colored error if the arguments are not equal
2831
*/
2932
export function json(
3033
actual: Record<string, unknown> | string[],
@@ -44,9 +47,9 @@ export function json(
4447
}
4548

4649
/**
47-
* Checks the two given strings line-by-line for equality.
48-
* Extra whitespace is ignored.
49-
* If there are any differences, it throws an exception with a Bash-colored diff as the error message.
50+
* Diffs two blocks of text, comparing line by line, ignoring leading and trailing whitespace.
51+
*
52+
* @throws a bash-colored error if the arguments are not equal
5053
*/
5154
export function trimmedLines(
5255
actual: string,
@@ -66,8 +69,9 @@ export function trimmedLines(
6669
}
6770

6871
/**
69-
* Checks the two given strings word-by-word for equality treating whitespace as significant.
70-
* If there are any differences, it throws an exception with a Bash-colored diff as the error message.
72+
* Diffs two blocks of text, comparing word by word, treating whitespace as significant.
73+
*
74+
* @throws a bash-colored error if the arguments are not equal
7175
*/
7276
export function wordsWithSpace(
7377
actual: string,

0 commit comments

Comments
 (0)