[Pkg-javascript-commits] [node-querystringify] 01/03: New upstream version 0.0.4

Thorsten Alteholz alteholz at moszumanska.debian.org
Sat Nov 5 11:04:10 UTC 2016


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

alteholz pushed a commit to branch master
in repository node-querystringify.

commit b527af8e1f1bf1c549d1b69f7b280d77e44dffc7
Author: Thorsten Alteholz <debian at alteholz.de>
Date:   Sat Nov 5 11:47:13 2016 +0100

    New upstream version 0.0.4
---
 .npmignore   |  3 +++
 .travis.yml  | 16 +++++-----------
 README.md    |  9 ++++++---
 index.js     |  2 +-
 package.json | 18 +++++++++---------
 test.js      | 13 +++++++++++++
 6 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..6038309
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,3 @@
+coverage/
+test.js
+.*
diff --git a/.travis.yml b/.travis.yml
index 22ebb02..a5f99ff 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,25 +1,19 @@
+sudo: false
 language: node_js
 node_js:
+  - "5"
+  - "4"
   - "0.12"
-  - "0.11"
   - "0.10"
-  - "0.9"
   - "0.8"
-  - "iojs-v1.1"
-  - "iojs-v1.0"
 before_install:
-  - "npm install -g npm at 1.4.x"
+  - 'if [ "${TRAVIS_NODE_VERSION}" == "0.8" ]; then npm install -g npm at 2.14.15; fi'
 script:
   - "npm run test-travis"
 after_script:
-  - "npm install coveralls at 2.11.x && cat coverage/lcov.info | coveralls"
+  - "npm install coveralls at 2 && cat coverage/lcov.info | coveralls"
 matrix:
   fast_finish: true
-  allow_failures:
-    - node_js: "0.11"
-    - node_js: "0.9"
-    - node_js: "iojs-v1.1"
-    - node_js: "iojs-v1.0"
 notifications:
   irc:
     channels:
diff --git a/README.md b/README.md
index a3c6471..e87f7f4 100644
--- a/README.md
+++ b/README.md
@@ -29,14 +29,16 @@ var qs = require('querystringify');
 
 ### qs.parse()
 
-The parse method transforms a given query string in to an object. It does not
-care if your query string if prefixed with a `?` or not. It just extracts the
-parts between the `=` and `&`:
+The parse method transforms a given query string in to an object. Parameters
+without values are set to empty strings. It does not care if your query string
+is prefixed with a `?` or not. It just extracts the parts between the `=` and
+`&`:
 
 ```js
 qs.parse('?foo=bar');         // { foo: 'bar' }
 qs.parse('foo=bar');          // { foo: 'bar' }
 qs.parse('foo=bar&bar=foo');  // { foo: 'bar', bar: 'foo' }
+qs.parse('foo&bar=foo');      // { foo: '', bar: 'foo' }
 ```
 
 ### qs.stringify()
@@ -50,6 +52,7 @@ simply supply a string with the prefix value as second argument:
 qs.stringify({ foo: bar });       // foo=bar
 qs.stringify({ foo: bar }, true); // ?foo=bar
 qs.stringify({ foo: bar }, '&');  // &foo=bar
+qs.stringify({ foo: '' }, '&');   // &foo=
 ```
 
 ## License
diff --git a/index.js b/index.js
index 1610c2f..e1a2684 100644
--- a/index.js
+++ b/index.js
@@ -10,7 +10,7 @@ var has = Object.prototype.hasOwnProperty;
  * @api public
  */
 function querystring(query) {
-  var parser = /([^=?&]+)=([^&]*)/g
+  var parser = /([^=?&]+)=?([^&]*)/g
     , result = {}
     , part;
 
diff --git a/package.json b/package.json
index fb91ebf..30dc1f5 100644
--- a/package.json
+++ b/package.json
@@ -1,13 +1,13 @@
 {
   "name": "querystringify",
-  "version": "0.0.3",
+  "version": "0.0.4",
   "description": "Querystringify - Small, simple but powerful query string parser.",
   "main": "index.js",
   "scripts": {
-    "test": "mocha --reporter spec --ui bdd test.js",
-    "watch": "mocha --watch --reporter spec --ui bdd test.js",
-    "coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter spec --ui bdd test.js",
-    "test-travis": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- --reporter spec --ui bdd test.js"
+    "test": "mocha test.js",
+    "watch": "mocha --watch test.js",
+    "coverage": "istanbul cover _mocha -- test.js",
+    "test-travis": "istanbul cover _mocha --report lcovonly -- test.js"
   },
   "repository": {
     "type": "git",
@@ -31,9 +31,9 @@
   },
   "homepage": "https://github.com/unshiftio/querystringify",
   "devDependencies": {
-    "assume": "1.2.x",
-    "istanbul": "0.3.x",
-    "mocha": "2.2.x",
-    "pre-commit": "1.0.x"
+    "assume": "1.4.x",
+    "istanbul": "0.4.x",
+    "mocha": "2.4.x",
+    "pre-commit": "1.1.x"
   }
 }
diff --git a/test.js b/test.js
index 3778168..06d8cb2 100644
--- a/test.js
+++ b/test.js
@@ -31,6 +31,10 @@ describe('querystringify', function () {
       assume(qs.stringify({})).equals('');
     });
 
+    it('works with object keys with empty string values', function () {
+      assume(qs.stringify({ foo: '' })).equals('foo=');
+    })
+
     it('works with nulled objects', function () {
       var obj = Object.create(null);
 
@@ -58,5 +62,14 @@ describe('querystringify', function () {
       assume(obj.foo).equals('bar');
       assume(obj.shizzle).equals('mynizzle');
     });
+
+    it('works with querystring parameters without values', function () {
+      var obj = qs.parse('?foo&bar=&shizzle=mynizzle');
+
+      assume(obj).is.a('object');
+      assume(obj.foo).equals('');
+      assume(obj.bar).equals('');
+      assume(obj.shizzle).equals('mynizzle');
+    })
   });
 });

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



More information about the Pkg-javascript-commits mailing list