Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 1x 1x 1x | /** * 解析URL为一个对象 * @method location/parse * @param {String} str URL字符串 * @returns {Object} URL对象 * @see [url-parse](https://github.com/unshiftio/url-parse) * @example * var $parse = require('@spore-ui/kit/packages/location/parse'); * $parse('http://localhost/profile?beijing=huanyingni#123'); * // { * // slashes: true, * // protocol: 'http:', * // hash: '#123', * // query: '?beijing=huanyingni', * // pathname: '/profile', * // auth: 'username:password', * // host: 'localhost:8080', * // port: '8080', * // hostname: 'localhost', * // password: 'password', * // username: 'username', * // origin: 'http://localhost:8080', * // href: 'http://username:password@localhost:8080/profile?beijing=huanyingni#123' * // } */ var Url = require('url-parse'); function parse(url) { return new Url(url); } module.exports = parse; |