From 4a76826516dda30eee5f96f5057afaba6baa7e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Thu, 16 Jun 2016 15:30:40 +0800 Subject: [PATCH] using the native api --- querystr.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/querystr.js b/querystr.js index 24d1699..5f5208b 100644 --- a/querystr.js +++ b/querystr.js @@ -1,19 +1,11 @@ var cl = global.botanLoader; var CondStream = cl.load( "botanss.utils.CondStream" ); +var querystr = require( "querystring" ); module.exports = { queryStr: function( qstr ) { - var qObj = {}; - if( qstr instanceof CondStream ) qstr = qstr.toString(); - - qstr.split( "&" ).forEach( function( val ) - { - val = val.split( "=" ); - qObj[ val[0] ] = val[1] ? decodeURIComponent( val[1].replace( /\+/g, " " ) ) : ""; - } ); - - return qObj; + return querystr.parse( qstr ); } };