Skip to content

Commit

Permalink
Simplify comments (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgo committed Oct 27, 2020
1 parent c39eb87 commit b676cf5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import chalk from "chalk"
import * as diff from "diff"

/**
* Chars checks the two given strings character-by-character for equality.
* Checks the two given strings character-by-character for equality.
* If there are any differences, it throws an exception with a Bash-colored diff as the error message.
*/
export function chars(actual: string, expected: string, message = "mismatching strings") {
Expand All @@ -19,7 +19,7 @@ export function chars(actual: string, expected: string, message = "mismatching s
}

/**
* Json checks the two given Objects for equality.
* Checks the two given Objects for equality.
* If there are any differences, it throws an exception with a Bash-colored diff as the error message.
*/
export function json(actual: object, expected: object, message = "mismatching objects") {
Expand All @@ -36,7 +36,7 @@ export function json(actual: object, expected: object, message = "mismatching ob
}

/**
* Chars checks the two given strings line-by-line for equality.
* Checks the two given strings line-by-line for equality.
* Extra whitespace is ignored.
* If there are any differences, it throws an exception with a Bash-colored diff as the error message.
*/
Expand All @@ -54,8 +54,7 @@ export function trimmedLines(actual: string, expected: string, message = "mismat
}

/**
* WordsWithSpace checks the two given strings word-by-word for equality
* treating whitespace as significant.
* Checks the two given strings word-by-word for equality treating whitespace as significant.
* If there are any differences, it throws an exception with a Bash-colored diff as the error message.
*/
export function wordsWithSpace(actual: string, expected: string, message = "mismatching words") {
Expand Down Expand Up @@ -88,7 +87,7 @@ export function wordsWithSpace(actual: string, expected: string, message = "mism
// }
// }

/** GetColor returns the chalk function to render the given diff part. */
/** returns the chalk function to render the given diff part */
function getColor(part: diff.Change) {
if (part.added) {
return chalk.green
Expand All @@ -99,7 +98,7 @@ function getColor(part: diff.Change) {
return chalk.grey
}

/** RenderDiff renders the given diff into a string containing Bash colors. */
/** renders the given diff into a string containing Bash colors */
function renderDiff(differences: diff.Change[]): string {
let result = ""
for (const part of differences) {
Expand Down

0 comments on commit b676cf5

Please sign in to comment.