From c268144ad086b11dbb8cfaccaaefe0d6112d85af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=23=E4=BA=91=E6=B7=A1=E7=84=B6?= Date: Wed, 9 Nov 2016 11:42:24 +0800 Subject: [PATCH] =?UTF-8?q?~=20=E6=8E=A5=E5=8F=A3=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 ++++- src/index.js | 5 ++++- test/test.index.js | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f47b8c3..91654fa 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,10 @@ "dependencies": {}, "peerDependencies": { "blear.utils.hashbang": "1.x", - "blear.utils.url": "1.x" + "blear.utils.url": "1.x", + "blear.utils.access": "1.x", + "blear.utils.typeis": "1.x", + "blear.utils.object": "1.x" }, "devDependencies": { "jasmine-core": "^2.4.1", diff --git a/src/index.js b/src/index.js index 30ce0df..983d462 100644 --- a/src/index.js +++ b/src/index.js @@ -54,9 +54,12 @@ var get = exports.get = function () { * @returns {{path, query}|{path: string, query: *}} */ var parse = exports.parse = function () { - return object.filter(url.parse(get()), function (val, key) { + var ret = object.filter(url.parse(get()), function (val, key) { return PARSE_MAP[key]; }); + + ret.path = ret.href; + return ret; }; diff --git a/test/test.index.js b/test/test.index.js index 766361d..cdca8bd 100644 --- a/test/test.index.js +++ b/test/test.index.js @@ -30,6 +30,7 @@ describe('测试文件', function () { console.log(ret); expect(ret).toEqual({ + path: '/a/b/c/?x=1&y=2&z=3', href: '/a/b/c/?x=1&y=2&z=3', pathname: '/a/b/c/', query: {