diff --git a/README.md b/README.md index e969fa2..57aaf57 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +# graphqlify-null + +Fork of `graphqlify` that allows sending null values. Because who knows if [#8](https://github.com/kadirahq/graphqlify/pull/8) will ever be merged. + # graphqlify This module helps you build GraphQL queries using plain JavaScript objects. This can be useful when you need to programmatically build GraphQL queries. Install the module from npm to get started. diff --git a/package.json b/package.json index 0f6d049..48864f4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "graphqlify", + "name": "graphqlify-null", "version": "1.1.0", - "description": "Build GraphQL queries with JavaScript", + "description": "Build GraphQL queries with JavaScript (fork of graphqlify)", "main": "lib/index.js", "scripts": { "prepublish": "nofat make", @@ -9,17 +9,17 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/kadirahq/graphqlify.git" + "url": "git+https://github.com/Eiskis/graphqlify.git" }, "keywords": [ "graphql" ], - "author": "Kadira Inc.", + "author": "Eiskis", "license": "MIT", "bugs": { - "url": "https://github.com/kadirahq/graphqlify/issues" + "url": "https://github.com/Eiskis/graphqlify/issues" }, - "homepage": "https://github.com/kadirahq/graphqlify#readme", + "homepage": "https://github.com/Eiskis/graphqlify#readme", "devDependencies": { "nofat": "^2.0.0" } diff --git a/src/index.js b/src/index.js index ea4854b..7ad48c4 100644 --- a/src/index.js +++ b/src/index.js @@ -226,7 +226,7 @@ function encodeParamsMap(params) { const val = params[key]; return params.hasOwnProperty(key) && val !== undefined && - val !== null && + // val !== null && !Number.isNaN(val); }); @@ -247,6 +247,9 @@ function encodeParam(key, val) { // Enum('a') => 'a' // function encodeParamValue(value) { + if (value === null) { + return null; + } if (Array.isArray(value)) { return encodeParamsArray(value); }