cbor-edn
Version: 
Parse CBOR Extended Diagnostic Notation as defined by [draft-ietf-cbor-edn-literals-16](https://www.ietf.org/archive/id/draft-ietf-cbor-edn-literals-16.html) and some CBOR working group discussions.
19 lines (18 loc) • 433 B
JavaScript
/**
 * Pulled in here to keep this project web-safe.
 *
 * @param value Value to check.
 * @param message Message to throw if invalid.
 * @throws If !value.
 */
export function assert(value, message) {
    if (!value) {
        if (message) {
            if (message instanceof Error) {
                throw message;
            }
            throw new Error(message);
        }
        throw new Error(`${value} invalid`);
    }
}