graphql-input-number
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -20,4 +20,9 @@ 'use strict'; | ||
function coerceFloat(value) { | ||
var num = Number(value); | ||
return isSafeFloat(num) ? num : null; | ||
if (value != null) { | ||
var num = Number(value); | ||
if (isSafeFloat(num)) { | ||
return num; | ||
} | ||
} | ||
return null; | ||
} | ||
@@ -24,0 +29,0 @@ |
@@ -22,5 +22,7 @@ 'use strict'; | ||
function coerceInt(value) { | ||
var num = Number(value); | ||
if (isSafeInteger(num)) { | ||
return (num < 0 ? Math.ceil : Math.floor)(num); | ||
if (value != null) { | ||
var num = Number(value); | ||
if (isSafeInteger(num)) { | ||
return (num < 0 ? Math.ceil : Math.floor)(num); | ||
} | ||
} | ||
@@ -27,0 +29,0 @@ return null; |
{ | ||
"name": "graphql-input-number", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "A configurable custom input number type for GraphQL with sanitization and validation.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
7731
163