Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
chuigda authored Aug 27, 2021
1 parent d4aade1 commit c0758d5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Minimal JavaScript type assertions

## Basic usage
```javascript
const { typeAssert } = require('./typeAssert')
// or you use import if use ESM
const { typeAssert } = require('./typeAssert.cjs')

// simple types
typeAssert(1, 'number')
Expand Down Expand Up @@ -78,4 +79,7 @@ typeAssert({
}
]
}, assertion)

// chained situation
typeAssert(5, 'number'.chainWith(x => x > 0 ? true : 'no negative numbers'))
```

0 comments on commit c0758d5

Please sign in to comment.