Getting started
Follow the instructions below to use Emery in your application.
Install
Install the library:
npm install emery
or
yarn add emery
Import
Import the library:
const emery = require('emery');
If you're using ESM:
import * as emery from 'emery';
Modules
Emery's already tiny (~3kB minified) but if you prefer just grab the parts you need:
Assertions
An assertion declares that a condition be true
before executing subsequent code, ensuring that whatever condition is checked must be true for the remainder of the containing scope.
import assertions from 'emery/assertions';
Checks
Checks are just predicates that can't easily be expressed as type guards. Handy for dealing with ambiguous types.
import checks from 'emery/checks';
Guards
A collection of common guards. Type guards allow you to narrow the type of a value.
import guards from 'emery/guards';
Opaques
Opaque types encode primitive types with information about program semantics.
import opaques from 'emery/opaques';
Utils
Utilities for smoothing over areas of TS that are loosely typed.
import utils from 'emery/utils';