UNPKG

tiny-types

Version:

A tiny library that brings Tiny Types to JavaScript and TypeScript

22 lines 682 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isDefined = isDefined; const Predicate_1 = require("./Predicate"); /** * @desc Ensures that the `value` is defined as anything other than {@link null} or {@link undefined}. * * @example * import { ensure, isDefined, TinyType } from 'tiny-types'; * * class Name extends TinyType { * constructor(public readonly value: string) { * ensure('Name', value, isDefined()); * } * } * * @returns {Predicate<T>} */ function isDefined() { return Predicate_1.Predicate.to(`be defined`, (value) => !(value === null || value === undefined)); } //# sourceMappingURL=isDefined.js.map