is-date-object
Advanced tools
+4
-155
| { | ||
| "env": { | ||
| "browser": false, | ||
| "node": true, | ||
| "amd": false, | ||
| "mocha": false, | ||
| "jasmine": false | ||
| }, | ||
| "root": true, | ||
| "extends": "@ljharb", | ||
| "rules": { | ||
| "block-scoped-var": [0], | ||
| "brace-style": [2, "1tbs", { "allowSingleLine": true }], | ||
| "camelcase": [2], | ||
| "comma-spacing": [2], | ||
| "comma-style": [2, "last"], | ||
| "complexity": [0, 11], | ||
| "consistent-return": [2], | ||
| "consistent-this": [0, "that"], | ||
| "curly": [2, "all"], | ||
| "default-case": [2], | ||
| "dot-notation": [2, { "allowKeywords": true }], | ||
| "eol-last": [2], | ||
| "eqeqeq": [2], | ||
| "func-names": [0], | ||
| "func-style": [0, "declaration"], | ||
| "global-strict": [0, "never"], | ||
| "guard-for-in": [0], | ||
| "handle-callback-err": [0], | ||
| "key-spacing": [2, { "beforeColon": false, "afterColon": true }], | ||
| "quotes": [2, "single", "avoid-escape"], | ||
| "max-depth": [0, 4], | ||
| "max-len": [0, 80, 4], | ||
| "max-nested-callbacks": [0, 2], | ||
| "max-params": [0, 3], | ||
| "max-statements": [0, 10], | ||
| "new-parens": [2], | ||
| "new-cap": [2], | ||
| "no-alert": [2], | ||
| "no-array-constructor": [2], | ||
| "no-bitwise": [0], | ||
| "no-caller": [2], | ||
| "no-catch-shadow": [2], | ||
| "no-comma-dangle": [2], | ||
| "no-cond-assign": [2], | ||
| "no-console": [2], | ||
| "no-constant-condition": [2], | ||
| "no-control-regex": [2], | ||
| "no-debugger": [2], | ||
| "no-delete-var": [2], | ||
| "no-div-regex": [0], | ||
| "no-dupe-keys": [2], | ||
| "no-else-return": [0], | ||
| "no-empty": [2], | ||
| "no-empty-class": [2], | ||
| "no-empty-label": [2], | ||
| "no-eq-null": [0], | ||
| "no-eval": [2], | ||
| "no-ex-assign": [2], | ||
| "no-extend-native": [2], | ||
| "no-extra-bind": [2], | ||
| "no-extra-boolean-cast": [2], | ||
| "no-extra-parens": [0], | ||
| "no-extra-semi": [2], | ||
| "no-extra-strict": [2], | ||
| "no-fallthrough": [2], | ||
| "no-floating-decimal": [2], | ||
| "no-func-assign": [2], | ||
| "no-implied-eval": [2], | ||
| "no-inline-comments": [0], | ||
| "no-inner-declarations": [2, "functions"], | ||
| "no-invalid-regexp": [2], | ||
| "no-irregular-whitespace": [2], | ||
| "no-iterator": [2], | ||
| "no-label-var": [2], | ||
| "no-labels": [2], | ||
| "no-lone-blocks": [2], | ||
| "no-lonely-if": [2], | ||
| "no-loop-func": [2], | ||
| "no-mixed-requires": [0, false], | ||
| "no-mixed-spaces-and-tabs": [2, false], | ||
| "no-multi-spaces": [2], | ||
| "no-multi-str": [2], | ||
| "no-multiple-empty-lines": [0, {"max": 2}], | ||
| "no-native-reassign": [2], | ||
| "no-negated-in-lhs": [2], | ||
| "no-nested-ternary": [0], | ||
| "no-new": [2], | ||
| "no-new-func": [2], | ||
| "no-new-object": [2], | ||
| "no-new-require": [0], | ||
| "no-new-wrappers": [2], | ||
| "no-obj-calls": [2], | ||
| "no-octal": [2], | ||
| "no-octal-escape": [2], | ||
| "no-path-concat": [0], | ||
| "no-plusplus": [0], | ||
| "no-process-env": [0], | ||
| "no-process-exit": [2], | ||
| "no-proto": [2], | ||
| "no-redeclare": [2], | ||
| "no-regex-spaces": [2], | ||
| "no-reserved-keys": [2], | ||
| "no-restricted-modules": [0], | ||
| "no-return-assign": [2], | ||
| "no-script-url": [2], | ||
| "no-self-compare": [0], | ||
| "no-sequences": [2], | ||
| "no-shadow": [2], | ||
| "no-shadow-restricted-names": [2], | ||
| "no-space-before-semi": [2], | ||
| "no-spaced-func": [2], | ||
| "no-sparse-arrays": [2], | ||
| "no-sync": [0], | ||
| "no-ternary": [0], | ||
| "no-trailing-spaces": [2], | ||
| "no-undef": [2], | ||
| "no-undef-init": [2], | ||
| "no-undefined": [0], | ||
| "no-underscore-dangle": [2], | ||
| "no-unreachable": [2], | ||
| "no-unused-expressions": [2], | ||
| "no-unused-vars": [2, { "vars": "all", "args": "after-used" }], | ||
| "no-use-before-define": [2], | ||
| "no-void": [0], | ||
| "no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }], | ||
| "no-with": [2], | ||
| "no-wrap-func": [2], | ||
| "one-var": [0], | ||
| "operator-assignment": [0, "always"], | ||
| "padded-blocks": [0], | ||
| "quote-props": [0], | ||
| "radix": [0], | ||
| "semi": [2], | ||
| "sort-vars": [0], | ||
| "space-after-keywords": [2, "always", { "checkFunctionKeyword": true }], | ||
| "space-before-blocks": [0, "always"], | ||
| "space-in-brackets": [0, "never", { | ||
| "singleValue": true, | ||
| "arraysInArrays": false, | ||
| "arraysInObjects": false, | ||
| "objectsInArrays": true, | ||
| "objectsInObjects": true, | ||
| "propertyName": false | ||
| }], | ||
| "space-in-parens": [2, "never"], | ||
| "space-infix-ops": [2], | ||
| "space-return-throw-case": [2], | ||
| "space-after-function-name": [2, "never"], | ||
| "space-unary-ops": [2, { "words": true, "nonwords": false }], | ||
| "spaced-line-comment": [0, "always"], | ||
| "strict": [0], | ||
| "use-isnan": [2], | ||
| "valid-jsdoc": [0], | ||
| "valid-typeof": [2], | ||
| "vars-on-top": [0], | ||
| "wrap-iife": [2], | ||
| "wrap-regex": [2], | ||
| "yoda": [2, "never", { "exceptRange": true }] | ||
| "max-statements": [2, 12] | ||
| } | ||
| } |
+55
-1
| { | ||
| "es3": true, | ||
| "additionalRules": [], | ||
| "requireSemicolons": true, | ||
| "disallowMultipleSpaces": true, | ||
| "disallowIdentifierNames": [], | ||
| "requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], | ||
@@ -10,2 +18,14 @@ | ||
| "disallowSpaceBeforeComma": true, | ||
| "disallowSpaceBeforeSemicolon": true, | ||
| "disallowNodeTypes": [ | ||
| "DebuggerStatement", | ||
| "ForInStatement", | ||
| "LabeledStatement", | ||
| "SwitchCase", | ||
| "SwitchStatement", | ||
| "WithStatement" | ||
| ], | ||
| "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, | ||
@@ -67,4 +87,38 @@ "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, | ||
| "mark": "'" | ||
| } | ||
| }, | ||
| "disallowOperatorBeforeLineBreak": [], | ||
| "requireSpaceBeforeKeywords": [ | ||
| "do", | ||
| "for", | ||
| "if", | ||
| "else", | ||
| "switch", | ||
| "case", | ||
| "try", | ||
| "catch", | ||
| "finally", | ||
| "while", | ||
| "with", | ||
| "return" | ||
| ], | ||
| "validateAlignedFunctionParameters": { | ||
| "lineBreakAfterOpeningBraces": true, | ||
| "lineBreakBeforeClosingBraces": true | ||
| }, | ||
| "requirePaddingNewLinesBeforeExport": true, | ||
| "validateNewlineAfterArrayElements": { | ||
| "maximum": 1 | ||
| }, | ||
| "requirePaddingNewLinesAfterUseStrict": true, | ||
| "disallowArrowFunctions": true, | ||
| "validateOrderInObjectKeys": "asc-insensitive" | ||
| } | ||
+41
-1
| language: node_js | ||
| node_js: | ||
| - "4.1" | ||
| - "4.0" | ||
| - "iojs-v3.3" | ||
| - "iojs-v3.2" | ||
| - "iojs-v3.1" | ||
| - "iojs-v3.0" | ||
| - "iojs-v2.5" | ||
| - "iojs-v2.4" | ||
| - "iojs-v2.3" | ||
| - "iojs-v2.2" | ||
| - "iojs-v2.1" | ||
| - "iojs-v2.0" | ||
| - "iojs-v1.8" | ||
| - "iojs-v1.7" | ||
| - "iojs-v1.6" | ||
| - "iojs-v1.5" | ||
| - "iojs-v1.4" | ||
| - "iojs-v1.3" | ||
| - "iojs-v1.2" | ||
| - "iojs-v1.1" | ||
| - "iojs-v1.0" | ||
| - "0.12" | ||
| - "0.11" | ||
@@ -10,3 +32,3 @@ - "0.10" | ||
| before_install: | ||
| - '[ "${TRAVIS_NODE_VERSION}" == "0.6" ] || npm install -g npm@~1.4.6' | ||
| - '[ "${TRAVIS_NODE_VERSION}" = "0.6" ] || npm install -g npm@1.4.28 && npm install -g npm' | ||
| sudo: false | ||
@@ -16,5 +38,23 @@ matrix: | ||
| allow_failures: | ||
| - node_js: "4.0" | ||
| - node_js: "iojs-v3.2" | ||
| - node_js: "iojs-v3.1" | ||
| - node_js: "iojs-v3.0" | ||
| - node_js: "iojs-v2.4" | ||
| - node_js: "iojs-v2.3" | ||
| - node_js: "iojs-v2.2" | ||
| - node_js: "iojs-v2.1" | ||
| - node_js: "iojs-v2.0" | ||
| - node_js: "iojs-v1.7" | ||
| - node_js: "iojs-v1.6" | ||
| - node_js: "iojs-v1.5" | ||
| - node_js: "iojs-v1.4" | ||
| - node_js: "iojs-v1.3" | ||
| - node_js: "iojs-v1.2" | ||
| - node_js: "iojs-v1.1" | ||
| - node_js: "iojs-v1.0" | ||
| - node_js: "0.11" | ||
| - node_js: "0.9" | ||
| - node_js: "0.8" | ||
| - node_js: "0.6" | ||
| - node_js: "0.4" |
+7
-0
@@ -0,3 +1,10 @@ | ||
| 1.0.1 / 2015-09-27 | ||
| ================= | ||
| * [Fix] If `@@toStringTag` is not present, use the old-school `Object#toString` test | ||
| * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG | ||
| * [Dev Deps] update `is`, `eslint`, `@ljharb/eslint-config`, `semver`, `tape`, `jscs`, `nsp`, `covert` | ||
| * [Tests] up to `io.js` `v3.3`, `node` `v4.1` | ||
| 1.0.0 / 2015-01-28 | ||
| ================= | ||
| * Initial release. |
+10
-2
| 'use strict'; | ||
| var getDay = Date.prototype.getDay; | ||
| module.exports = function isDateObject(value) { | ||
| var tryDateObject = function tryDateObject(value) { | ||
| try { | ||
@@ -13,1 +12,10 @@ getDay.call(value); | ||
| }; | ||
| var toStr = Object.prototype.toString; | ||
| var dateClass = '[object Date]'; | ||
| var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; | ||
| module.exports = function isDateObject(value) { | ||
| if (typeof value !== 'object' || value === null) { return false; } | ||
| return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass; | ||
| }; |
+11
-12
| { | ||
| "name": "is-date-object", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "author": "Jordan Harband", | ||
@@ -15,3 +15,2 @@ "description": "Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", | ||
| "eslint": "eslint test.js *.js", | ||
| "eccheck": "editorconfig-tools check *.js **/*.js > /dev/null", | ||
| "security": "nsp package" | ||
@@ -32,12 +31,12 @@ }, | ||
| "devDependencies": { | ||
| "foreach": "~2.0.5", | ||
| "is": "~2.2.0", | ||
| "tape": "~3.4.0", | ||
| "indexof": "~0.0.1", | ||
| "covert": "1.0.0", | ||
| "jscs": "~1.10.0", | ||
| "editorconfig-tools": "~0.0.1", | ||
| "nsp": "~1.0.0", | ||
| "eslint": "~0.12.0", | ||
| "semver": "~4.2.0" | ||
| "foreach": "^2.0.5", | ||
| "is": "^3.1.0", | ||
| "tape": "^4.2.0", | ||
| "indexof": "^0.0.1", | ||
| "covert": "^1.1.0", | ||
| "jscs": "^2.1.1", | ||
| "nsp": "^1.1.0", | ||
| "eslint": "^1.5.1", | ||
| "@ljharb/eslint-config": "^1.2.0", | ||
| "semver": "^5.0.3" | ||
| }, | ||
@@ -44,0 +43,0 @@ "testling": { |
+1
-1
@@ -40,3 +40,3 @@ # is-date-object <sup>[![Version Badge][2]][1]</sup> | ||
| [1]: https://npmjs.org/package/is-date-object | ||
| [2]: http://vb.teelaun.ch/ljharb/is-date-object.svg | ||
| [2]: http://versionbadg.es/ljharb/is-date-object.svg | ||
| [3]: https://travis-ci.org/ljharb/is-date-object.svg | ||
@@ -43,0 +43,0 @@ [4]: https://travis-ci.org/ljharb/is-date-object |
+2
-2
@@ -24,4 +24,4 @@ 'use strict'; | ||
| var realDate = new Date(); | ||
| var fakeDate = { valueOf: function () { return realDate.getTime(); }, toString: function () { return String(realDate); } }; | ||
| fakeDate[Symbol.toStringTag] = function () { return 'Date'; }; | ||
| var fakeDate = { toString: function () { return String(realDate); }, valueOf: function () { return realDate.getTime(); } }; | ||
| fakeDate[Symbol.toStringTag] = 'Date'; | ||
| t.notOk(isDate(fakeDate), 'fake Date with @@toStringTag "Date" is not Date'); | ||
@@ -28,0 +28,0 @@ t.end(); |
127
58.75%14959
-10.68%