A Node.js library written in TypeScript providing argument validation.
import * as expect from '@fantasticfiasco/expect';
function update(person) {
expect.toExist(person.name);
expect.toBeTrue(person.age >= 0, 'existential theories are not up for discussion');
// Squint your eyes and imagine your code here...
}
npm install @fantasticfiasco/expect
# or
yarn add @fantasticfiasco/expect
condition: boolean
The condition expected to be trueerrorMessage: string
The optional error message displayed if expectation fails
Expect a condition to be true.
condition: boolean
The condition expected to be falseerrorMessage: string
The optional error message displayed if expectation fails
Expect a condition to be false.
value: T
The value expected to existerrorMessage: string
The optional error message displayed if expectation fails
Expect a value to exist.
value: T
The value expected not to existerrorMessage: string
The optional error message displayed if expectation fails
Expect a value not to exist.
value: string
The value expected to be alphanumericerrorMessage: string
The optional error message displayed if expectation fails
Expect a value to be alphanumeric.
value: string
The value expected to have characters from a range of character codesminCharCode: number
The expected minimum character codemaxCharCode: number
The expected maximum character codeerrorMessage: string
The optional error message displayed if expectation fails
Expect a value to only contain characters from a range of character codes.
Thank you JetBrains for your important initiative to support the open source community with free licenses to your products.