tiny-types
Version:
A tiny library that brings Tiny Types to JavaScript and TypeScript
25 lines • 682 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isArray = isArray;
const Predicate_1 = require("./Predicate");
/**
* @desc Ensures that the `value` is an {@link Array}.
*
* @example
* import { ensure, isArray, TinyType, TinyTypeOf } from 'tiny-types';
*
* class Name extends TinyTypeOf<string>() {}
*
* class Names extends TinyType {
* constructor(public readonly values: Name[]) {
* super();
* ensure('Names', values, isArray());
* }
* }
*
* @returns {Predicate<T[]>}
*/
function isArray() {
return Predicate_1.Predicate.to(`be an array`, (value) => Array.isArray(value));
}
//# sourceMappingURL=isArray.js.map