Skip to content

Commit

Permalink
Add well-known actual, expected fields
Browse files Browse the repository at this point in the history
Closes GH-12.

Reviewed-by: Titus Wormer <tituswormer@gmail.com>
  • Loading branch information
remcohaszing authored Dec 27, 2021
1 parent 667d6f6 commit 8a8ccbb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ export class VFileMessage extends Error {
// Feel free to add other non-standard fields to your messages.

/* eslint-disable no-unused-expressions */
/**
* You can use this to specify the source value that’s being reported, which
* is deemed incorrect.
* @type {string?}
*/
this.actual
/**
* You can use this to suggest values that should be used instead of
* `actual`, one or more values that are deemed as acceptable.
* @type {Array<string>?}
*/
this.expected
/**
* You may add a file property with a path of a file (used throughout the VFile ecosystem).
* @type {string?}
Expand Down
10 changes: 10 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ Stack of message (`string?`).
It’s OK to store custom data directly on the `VFileMessage`, some of those are
handled by [utilities][util].

###### `actual`

You can use this to specify the source value that’s being reported, which is
deemed incorrect.

###### `expected`

You can use this to suggest values that should be used instead of `actual`, one
or more values that are deemed as acceptable.

###### `file`

You may add a `file` property with a path of a file (used throughout the
Expand Down

0 comments on commit 8a8ccbb

Please sign in to comment.