[Pkg-javascript-commits] [node-dargs] 30/54: use `Number.isNaN()` ponyfill

Bastien Roucariès rouca at moszumanska.debian.org
Wed Sep 6 09:41:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-dargs.

commit a842e949e3b38622923fe2a84d2818062d0a5d49
Author: Sindre Sorhus <sindresorhus at gmail.com>
Date:   Wed May 20 22:53:14 2015 +0200

    use `Number.isNaN()` ponyfill
---
 index.js     | 3 ++-
 package.json | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/index.js b/index.js
index 53288e6..b985d82 100644
--- a/index.js
+++ b/index.js
@@ -1,4 +1,5 @@
 'use strict';
+var numberIsNan = require('number-is-nan');
 
 function createArg(key, val) {
 	key = key.replace(/[A-Z]/g, '-$&').toLowerCase();
@@ -33,7 +34,7 @@ module.exports = function (input, opts) {
 			args.push(createArg(key, val));
 		}
 
-		if (typeof val === 'number' && isNaN(val) === false) {
+		if (typeof val === 'number' && !numberIsNan(val)) {
 			args.push(createArg(key, '' + val));
 		}
 
diff --git a/package.json b/package.json
index 671bd03..ff5d405 100644
--- a/package.json
+++ b/package.json
@@ -33,6 +33,9 @@
   "scripts": {
     "test": "node test.js"
   },
+  "dependencies": {
+    "number-is-nan": "^1.0.0"
+  },
   "devDependencies": {
     "array-equal": "^1.0.0",
     "ava": "^0.0.4"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-dargs.git



More information about the Pkg-javascript-commits mailing list