UNPKG

vue-ts-types

Version:

Lightweight TypeScript-first Vue prop type definitions

12 lines (11 loc) 408 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isNonNegative = void 0; /** Validator that only allows non-negative numbers (`>= 0`). */ const isNonNegative = (value) => { if (typeof value !== 'number' || value < 0 || Number.isNaN(value)) { return 'value should be a non-negative number'; } return undefined; }; exports.isNonNegative = isNonNegative;