source: node_modules/ramda-adjunct/es/isValidDate.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 751 bytes
Line 
1import { invoker, both, pipe, curryN } from 'ramda';
2import isDate from './isDate';
3import isNotNaN from './isNotNaN';
4
5/* eslint-disable max-len */
6/**
7 * Checks if value is valid `Date` object.
8 *
9 * @func isValidDate
10 * @memberOf RA
11 * @since {@link https://char0n.github.io/ramda-adjunct/1.8.0|v1.8.0}
12 * @category Type
13 * @sig * -> Boolean
14 * @param {*} val The value to test
15 * @return {boolean}
16 * @see {@link RA.isDate|isDate}, {@link RA.isNotDate|isNotDate}, {@link RA.isNotValidDate|isNotValidDate}
17 * @example
18 *
19 * RA.isValidDate(new Date()); //=> true
20 * RA.isValidDate(new Date('a')); //=> false
21 */
22/* eslint-enable max-len */
23var isValidDate = curryN(1, both(isDate, pipe(invoker(0, 'getTime'), isNotNaN)));
24export default isValidDate;
Note: See TracBrowser for help on using the repository browser.