@nodebysam/tiny-validation
Version:
Tiny Validation is a lightweight, chainable input validation library for Node.js. Validate strings, numbers, emails, and more with ease. Example: validate(input).isEmail().isNotEmpty(). No dependencies, simple API, and perfect for quick validation needs w
20 lines (18 loc) • 667 B
JavaScript
/**
* TINY VALIDATION
* A minimalistic NodeJS data validation library
*
* By Sam Wilcox <wilcox.sam@gmail.com>
*
* This library is relased under the GNU v3.0 license.
* For further details, see the LICENSE file.
*/
/**
* Validates whether the value is before the comparison Date.
*
* @param {any} value - The value to validate.
* @param {Date} comparisonDate - The comparison Date object.
* @returns {boolean} True if value is before comparsion date, false if not.
*/
const isBeforeDate = (value, comparisonDate) => value instanceof Date && comparisonDate instanceof Date && value < comparisonDate;
module.exports = isBeforeDate;