[Pkg-javascript-commits] [node-url-parse] 03/04: Imported Upstream version 1.0.5

Thorsten Alteholz alteholz at moszumanska.debian.org
Sun Feb 7 13:11:18 UTC 2016


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

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

commit 4d4db79a9c619d73ec6c7021228fe8352a354071
Author: Thorsten Alteholz <debian at alteholz.de>
Date:   Sun Feb 7 14:11:11 2016 +0100

    Imported Upstream version 1.0.5
---
 .travis.yml  | 39 ++++++++++++++++++++-------------------
 .zuul.yml    | 21 +++++++++++++++++++++
 README.md    | 18 +++++++++++-------
 fuzzy.js     | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 index.js     |  8 ++------
 package.json | 59 ++++++++++++++++++++---------------------------------------
 test.js      | 30 +++++++++++++++++++++++++++---
 7 files changed, 151 insertions(+), 79 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 22ebb02..d958dcd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,25 +1,26 @@
+sudo: false
 language: node_js
-node_js:
-  - "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"
-script:
-  - "npm run test-travis"
-after_script:
-  - "npm install coveralls at 2.11.x && 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"
+  include:
+    - node_js: "0.10"
+      env: TASK=test-node
+    - node_js: "0.12"
+      env: TASK=test-node
+    - node_js: "iojs"
+      env: TASK=test-node
+    - node_js: "4"
+      env: TASK=test-node
+    - node_js: "4"
+      env: TASK=test-browser
+env:
+  global:
+    - secure: edovUXd/s/VAVXTor0CT1XcGqAtBwGgLYN1zYq0JcNiJUgWFiZ5VGKYbKVpb6nKlwm0Fdi1xmByguSa6xLZllcXjtDgfXrkI1cQYmoVncJ63JpXNG+UKyy43BwnF2OqgUrAAOt/ic1YJr9kBe+IaRwDUsMxxIkuJ6Z8c4diX0HE=
+    - secure: IF01oyIKSs0C5dARdYRTilKnU1TG4zenjjEPClkQxAWIpUOxl9xcNJWDVEOPxJ/4pVt+pozyT80Rp7efh6ZiREJIQI1tUboBKSqZzSbnD5uViQNSbQ90PaDP0FIUc0IQ5o07W36rijBB0DTmtU1VofzN9PKkJO7XiSSXevI8RcM=
+script:
+  - "npm run ${TASK}"
+after_script:
+  - 'if [ "${TASK}" == "test-node" ]; then npm i coveralls at 2 && cat coverage/lcov.info | coveralls; fi'
 notifications:
   irc:
     channels:
diff --git a/.zuul.yml b/.zuul.yml
new file mode 100644
index 0000000..cdafdf9
--- /dev/null
+++ b/.zuul.yml
@@ -0,0 +1,21 @@
+ui: mocha-bdd
+browsers:
+  - name: android
+    version: [oldest, latest]
+  - name: chrome
+    version: [oldest, latest]
+  - name: firefox
+    version: [oldest, latest]
+  - name: ie
+    version: oldest..latest
+  - name: iphone
+    version: [oldest, latest]
+  - name: opera
+    version: oldest..latest
+  - name: safari
+    version: oldest..latest
+  - name: microsoftedge
+    version: oldest..latest
+capabilities:
+  record-screenshots: false
+  record-video: false
diff --git a/README.md b/README.md
index e0ead1f..b5fdd6d 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,12 @@
 # url-parse
-[![Made by unshift](https://img.shields.io/badge/made%20by-unshift-00ffcc.svg?style=flat-square)](http://unshift.io)[![Version npm](http://img.shields.io/npm/v/url-parse.svg?style=flat-square)](http://browsenpm.org/package/url-parse)[![Build Status](http://img.shields.io/travis/unshiftio/url-parse/master.svg?style=flat-square)](https://travis-ci.org/unshiftio/url-parse)[![Dependencies](https://img.shields.io/david/unshiftio/url-parse.svg?style=flat-square)](https://david-dm.org/unshiftio [...]
+[![Made by unshift](https://img.shields.io/badge/made%20by-unshift-00ffcc.svg?style=flat-square)](http://unshift.io)[![Version npm](https://img.shields.io/npm/v/url-parse.svg?style=flat-square)](http://browsenpm.org/package/url-parse)[![Build Status](https://img.shields.io/travis/unshiftio/url-parse/master.svg?style=flat-square)](https://travis-ci.org/unshiftio/url-parse)[![Dependencies](https://img.shields.io/david/unshiftio/url-parse.svg?style=flat-square)](https://david-dm.org/unshift [...]
 
-The `url-parse` method exposes two different API interfaces. The `url` interface
-that you know from Node.js and the new `URL` interface that is available in the
-latest browsers.
+[![Sauce Test Status](https://saucelabs.com/browser-matrix/url-parse.svg)](https://saucelabs.com/u/url-parse)
+
+The `url-parse` method exposes two different API interfaces. The
+[`url`](https://nodejs.org/api/url.html) interface that you know from Node.js
+and the new [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL)
+interface that is available in the latest browsers.
 
 Since `0.1` we've moved away from using the DOM's `<a>` element for URL parsing
 and moving to a full Regular Expression solution. The main reason for this
@@ -57,15 +60,16 @@ var parse = require('url-parse')
 
 The returned `url` instance contains the following properties:
 
-- `protocol`: Without slashes `http:`.
+- `protocol`: Requested protocol without slashes (e.g. `http:`).
 - `username`: Username of basic authentication.
 - `password`: Password of basic authentication.
+- `auth`: Authentication information portion (e.g. `username:password`).
 - `host`: Host name with port number.
 - `hostname`: Host name without port number.
 - `port`: Optional port number.
 - `pathname`: URL path.
 - `query`: Parsed object containing query string, unless parsing is set to false.
-- `hash`: Prefixed with `#`
+- `hash`: The "fragment" portion of the URL including the pound-sign (`#`).
 - `href`: The full URL.
 
 ### URL.set(key, value)
@@ -115,4 +119,4 @@ The testing of this module is done in 3 different ways:
 
 ## License
 
-MIT
+[MIT](LICENSE)
diff --git a/fuzzy.js b/fuzzy.js
index b445753..c0abe3c 100644
--- a/fuzzy.js
+++ b/fuzzy.js
@@ -12,14 +12,59 @@ var URL = require('./')
  */
 var combinations = {};
 
-combinations.protocol = ['http:', 'https:', 'ws:', 'wss:', 'blob:'/*, ''*/];
+combinations.protocol = [
+  'http:',
+  'https:',
+  'ws:',
+  'wss:',
+  'blob:'/*,
+  ''*/
+];
 combinations.username = ['foo', 'bar'];
 combinations.password = combinations.username;
-combinations.hostname = ['example.com', 'www.example.com', 'travel.travel', 'sub.sub.sub.domain.nl', 'xn--n3h.com', 'localhost', '127.0.0.1', '255.255.255.255', /*'3ffe:6a88:85a3:08d3:1319:8a2e:0370:7344', '2001:2353::1428:57ab', '2001:2353:0::0:1428:57ab', '2001:2353:0:0:0:0:1428:57ab', '2001:2353:0000:0000:0000::1428:57ab', '2001:2353:0000:0000:0000:0000:1428:57ab', '2001:2353:02de::0e13', '2001:2353:2de::e13'*/];
+combinations.hostname = [
+  'example.com',
+  'www.example.com',
+  'travel.travel',
+  'sub.sub.sub.domain.nl',
+  'xn--n3h.com',
+  'localhost',
+  '127.0.0.1',
+  '255.255.255.255'/*,
+  '3ffe:6a88:85a3:08d3:1319:8a2e:0370:7344',
+  '2001:2353::1428:57ab',
+  '2001:2353:0::0:1428:57ab',
+  '2001:2353:0:0:0:0:1428:57ab',
+  '2001:2353:0000:0000:0000::1428:57ab',
+  '2001:2353:0000:0000:0000:0000:1428:57ab',
+  '2001:2353:02de::0e13',
+  '2001:2353:2de::e13'*/
+];
 combinations.port = ['8080', '844', '3340'];
-combinations.pathname = ['/', '/bar', '/bar/', '/foo/bar', '/foo.bar/foo', '/fav.ico', '/@3rd-Eden', '/a/b/c/d/e/f/g/j/1/d/4/'];
-combinations.query = ['foo=bar', 'foo[]=bar&foo[]=foo', 'email=foo at bar.travel', 'q='];
-combinations.hash = ['name', 'moo-with-longer-name', '/what/about/slashes?querystring', '?querystring', '!/google/urls', 'use:foo@', 'http://'];
+combinations.pathname = [
+  '/',
+  '/bar',
+  '/bar/',
+  '/foo/bar',
+  '/foo.bar/foo',
+  '/fav.ico',
+  '/@3rd-Eden',
+  '/a/b/c/d/e/f/g/j/1/d/4/'
+];
+combinations.query = ['foo=bar',
+  'foo[]=bar&foo[]=foo',
+  'email=foo at bar.travel',
+  'q='
+];
+combinations.hash = [
+  'name',
+  'moo-with-longer-name',
+  '/what/about/slashes?querystring',
+  '?querystring',
+  '!/google/urls',
+  'use:foo@',
+  'http://'
+];
 
 /**
  * Get a random item from the given array.
diff --git a/index.js b/index.js
index 92eaa4d..b7c822d 100644
--- a/index.js
+++ b/index.js
@@ -211,12 +211,8 @@ URL.prototype.toString = function toString(stringify) {
 
   result += url.pathname;
 
-  if (url.query) {
-    if ('object' === typeof url.query) query = stringify(url.query);
-    else query = url.query;
-
-    result += (query.charAt(0) === '?' ? '' : '?') + query;
-  }
+  query = 'object' === typeof url.query ? stringify(url.query) : url.query;
+  if (query) result += '?' !== query.charAt(0) ? '?'+ query : query;
 
   if (url.hash) result += url.hash;
 
diff --git a/package.json b/package.json
index dfef6e1..718b31e 100644
--- a/package.json
+++ b/package.json
@@ -1,17 +1,20 @@
 {
   "name": "url-parse",
-  "version": "1.0.2",
-  "description": "Parse URL in node using the URL module and in the browser using the DOM",
+  "version": "1.0.5",
+  "description": "Small footprint URL parser that works seamlessly across Node.js and browser environments",
   "main": "index.js",
   "scripts": {
     "100%": "istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
-    "test": "mocha test.js",
+    "browserify": "mkdir -p dist && browserify index.js -s URLParse -o dist/url-parse.js",
+    "test-node": "istanbul cover _mocha --report lcovonly -- test.js",
+    "coverage": "istanbul cover _mocha -- test.js",
+    "test-browser": "zuul -- test.js",
     "watch": "mocha --watch test.js",
-    "coverage": "istanbul cover ./node_modules/.bin/_mocha -- test.js",
-    "test-travis": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- test.js",
-    "browserify": "mkdir -p dist && browserify index.js -o dist/url-parse.js --standalone URLParse",
-    "phantomjs": "mochify --reporter spec --ui bdd ./test.js",
-    "testling": "testling -u"
+    "test": "mocha test.js"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/unshiftio/url-parse.git"
   },
   "keywords": [
     "URL",
@@ -26,38 +29,16 @@
   ],
   "author": "Arnout Kazemier",
   "license": "MIT",
-  "devDependencies": {
-    "assume": "1.1.x",
-    "browserify": "8.1.x",
-    "istanbul": "0.3.x",
-    "mocha": "2.1.x",
-    "mochify": "2.4.x",
-    "pre-commit": "1.0.x",
-    "testling": "1.7.x"
-  },
-  "testling": {
-    "files": "test.js",
-    "harness": "mocha-bdd",
-    "browsers": [
-      "ie/6..latest",
-      "chrome/22..latest",
-      "firefox/16..latest",
-      "safari/latest",
-      "opera/11.0..latest",
-      "iphone/6",
-      "ipad/6",
-      "android-browser/latest"
-    ]
-  },
-  "browser": {
-    "url": false
-  },
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/unshiftio/url-parse"
-  },
   "dependencies": {
     "querystringify": "0.0.x",
-    "requires-port": "0.0.x"
+    "requires-port": "1.0.x"
+  },
+  "devDependencies": {
+    "assume": "1.3.x",
+    "browserify": "12.0.x",
+    "istanbul": "0.4.x",
+    "mocha": "2.3.x",
+    "pre-commit": "1.1.x",
+    "zuul": "3.7.x"
   }
 }
diff --git a/test.js b/test.js
index 477b3d8..9770025 100644
--- a/test.js
+++ b/test.js
@@ -16,12 +16,25 @@ describe('url-parse', function () {
     assume(parse.location).equals(require('./lolcation'));
   });
 
-  it('parsers the query string', function () {
+  it('parses the query string into an object', function () {
     var url = 'http://google.com/?foo=bar'
       , data = parse(url, true);
 
     assume(data.query).is.a('object');
     assume(data.query.foo).equals('bar');
+
+    url = 'http://google.com/';
+    data = parse(url, true);
+
+    assume(data.query).is.a('object');
+    assume(data.query).is.empty();
+  });
+
+  it('does not add question mark to href if query string is empty', function () {
+    var url = 'http://google.com/'
+      , data = parse(url, true);
+
+    assume(data.href).equals(url);
   });
 
   it('allows a custom function as parser', function () {
@@ -48,8 +61,19 @@ describe('url-parse', function () {
   });
 
   it('is blob: location aware', function () {
-    var blob = {"hash":"","search":"","pathname":"https%3A//gist.github.com/3f272586-6dac-4e29-92d0-f674f2dde618","port":"","hostname":"","host":"","protocol":"blob:","origin":"https://gist.github.com","href":"blob:https%3A//gist.github.com/3f272586-6dac-4e29-92d0-f674f2dde618"}
-      , url = '/unshiftio/url-parse'
+    var blob = {
+      'href': 'blob:https%3A//gist.github.com/3f272586-6dac-4e29-92d0-f674f2dde618',
+      'pathname': 'https%3A//gist.github.com/3f272586-6dac-4e29-92d0-f674f2dde618',
+      'origin': 'https://gist.github.com',
+      'protocol': 'blob:',
+      'hostname': '',
+      'search': '',
+      'hash': '',
+      'host': '',
+      'port': ''
+    };
+
+    var url = '/unshiftio/url-parse'
       , data = parse(url, blob);
 
     assume(data.href).equals('https://gist.github.com/unshiftio/url-parse');

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



More information about the Pkg-javascript-commits mailing list