UNPKG

@grammyjs/i18n

Version:

Internationalization plugin for grammY based on Fluent.

28 lines (27 loc) 1.04 kB
"use strict"; // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // This module is browser compatible. Object.defineProperty(exports, "__esModule", { value: true }); exports.DenoStdInternalError = void 0; exports.assert = assert; exports.unreachable = unreachable; /** * All internal non-test code, that is files that do not have `test` or `bench` in the name, must use the assertion functions within `_utils/asserts.ts` and not `testing/asserts.ts`. This is to create a separation of concerns between internal and testing assertions. */ class DenoStdInternalError extends Error { constructor(message) { super(message); this.name = "DenoStdInternalError"; } } exports.DenoStdInternalError = DenoStdInternalError; /** Make an assertion, if not `true`, then throw. */ function assert(expr, msg = "") { if (!expr) { throw new DenoStdInternalError(msg); } } /** Use this to assert unreachable code. */ function unreachable() { throw new DenoStdInternalError("unreachable"); }