assertjunky
v1.0.0
Published
Tiny TypeScript assert library centered on scoped assert-route fallbacks
Downloads
104
Maintainers
Readme
assertjunky
Tiny TypeScript assert library centered on scoped assert-route fallbacks.
Install
npm i assertjunkyUsage
import * as sr from 'assertjunky';
const getName = sr.fn('unknown', (value: unknown) => {
sr.assertPlainObject(value);
sr.assertString(value.name);
return value.name;
});Core ideas
- Throwing assertions with good TypeScript narrowing
test()to convert assertion blocks into booleansfn()andfnAsync()to turn assert-failing branches into safe fallbacks- A broad assert helper library without complicating the core runtime model
Build
npm run build