Skip to content

Commit

Permalink
add back why section to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
BirdHighway committed Mar 12, 2024
1 parent b9022f7 commit f06eb0a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ invariant(falsyValue, 'This will throw!');
// Error('Invariant violation: This will throw!');
```

## Why `tiny-invariant`?
`tiny-invariant` is a *tiny*, widely-supported, zero-dependency alternative to [`invariant`](https://www.npmjs.com/package/invariant). See [below](#Dropping your message for kb savings!) for details on just how compact it can get.

## Error Messages

`tiny-invariant` allows you to pass a single string message. With [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) there is really no need for a custom message formatter to be built into the library. If you need a multi part message you can just do this:
Expand Down

0 comments on commit f06eb0a

Please sign in to comment.