1 | # is-date-object <sup>[![Version Badge][2]][1]</sup>
|
---|
2 |
|
---|
3 | [![github actions][actions-image]][actions-url]
|
---|
4 | [![coverage][codecov-image]][codecov-url]
|
---|
5 | [![dependency status][5]][6]
|
---|
6 | [![dev dependency status][7]][8]
|
---|
7 | [![License][license-image]][license-url]
|
---|
8 | [![Downloads][downloads-image]][downloads-url]
|
---|
9 |
|
---|
10 | [![npm badge][11]][1]
|
---|
11 |
|
---|
12 | Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
|
---|
13 |
|
---|
14 | ## Example
|
---|
15 |
|
---|
16 | ```js
|
---|
17 | var isDate = require('is-date-object');
|
---|
18 | var assert = require('assert');
|
---|
19 |
|
---|
20 | assert.notOk(isDate(undefined));
|
---|
21 | assert.notOk(isDate(null));
|
---|
22 | assert.notOk(isDate(false));
|
---|
23 | assert.notOk(isDate(true));
|
---|
24 | assert.notOk(isDate(42));
|
---|
25 | assert.notOk(isDate('foo'));
|
---|
26 | assert.notOk(isDate(function () {}));
|
---|
27 | assert.notOk(isDate([]));
|
---|
28 | assert.notOk(isDate({}));
|
---|
29 | assert.notOk(isDate(/a/g));
|
---|
30 | assert.notOk(isDate(new RegExp('a', 'g')));
|
---|
31 |
|
---|
32 | assert.ok(isDate(new Date()));
|
---|
33 | ```
|
---|
34 |
|
---|
35 | ## Tests
|
---|
36 | Simply clone the repo, `npm install`, and run `npm test`
|
---|
37 |
|
---|
38 | [1]: https://npmjs.org/package/is-date-object
|
---|
39 | [2]: https://versionbadg.es/inspect-js/is-date-object.svg
|
---|
40 | [5]: https://david-dm.org/inspect-js/is-date-object.svg
|
---|
41 | [6]: https://david-dm.org/inspect-js/is-date-object
|
---|
42 | [7]: https://david-dm.org/inspect-js/is-date-object/dev-status.svg
|
---|
43 | [8]: https://david-dm.org/inspect-js/is-date-object#info=devDependencies
|
---|
44 | [11]: https://nodei.co/npm/is-date-object.png?downloads=true&stars=true
|
---|
45 | [license-image]: https://img.shields.io/npm/l/is-date-object.svg
|
---|
46 | [license-url]: LICENSE
|
---|
47 | [downloads-image]: https://img.shields.io/npm/dm/is-date-object.svg
|
---|
48 | [downloads-url]: https://npm-stat.com/charts.html?package=is-date-object
|
---|
49 | [codecov-image]: https://codecov.io/gh/inspect-js/is-date-object/branch/main/graphs/badge.svg
|
---|
50 | [codecov-url]: https://app.codecov.io/gh/inspect-js/is-date-object/
|
---|
51 | [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-date-object
|
---|
52 | [actions-url]: https://github.com/inspect-js/is-date-object/actions
|
---|