Socket
Socket
Sign inDemoInstall

can-parse-uri

Package Overview
Dependencies
1
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.1.0

22

can-parse-uri-test.js

@@ -7,13 +7,13 @@ var parseURI = require('./can-parse-uri');

QUnit.test("basics", function(){
QUnit.deepEqual(parseURI("http://foo:8080/bar.html#change"), {
authority: "//foo:8080",
hash: "#change",
host: "foo:8080",
hostname: "foo",
href: "http://foo:8080/bar.html#change",
pathname: "/bar.html",
port: "8080",
protocol: "http:",
search: ""
});
QUnit.deepEqual(parseURI("http://foo:8080/bar.html?query#change"), {
authority: "//foo:8080",
hash: "#change",
host: "foo:8080",
hostname: "foo",
href: "http://foo:8080/bar.html?query#change",
pathname: "/bar.html",
port: "8080",
protocol: "http:",
search: "?query"
});
});

@@ -9,8 +9,25 @@ /**

*
* ```js
* import {parseURI} from "can"
* parseURI("http://foo:8080/bar.html?query#change")
* //-> {
* // authority: "//foo:8080",
* // hash: "#change",
* // host: "foo:8080",
* // hostname: "foo",
* // href: "http://foo:8080/bar.html?query#change",
* // pathname: "/bar.html",
* // port: "8080",
* // protocol: "http:",
* // search: "?query"
* // }
* ```
*
* @param {String} url The URL you want to parse.
*
* @return {Object} Returns an object with properties for each part of the URL.
* @return {Object} Returns an object with properties for each part of the URL. `null`
* is returned if the url can not be parsed.
*/
module.exports = function(url){
var namespace = require("can-namespace");
module.exports = namespace.parseURI = function(url){
var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);

@@ -17,0 +34,0 @@ // authority = '//' + user + ':' + pass '@' + hostname + ':' port

@@ -1,4 +0,10 @@

/*can-parse-uri@1.0.0#can-parse-uri*/
define(function (require, exports, module) {
module.exports = function (url) {
/*can-parse-uri@1.0.2#can-parse-uri*/
define([
'require',
'exports',
'module',
'can-namespace'
], function (require, exports, module) {
var namespace = require('can-namespace');
module.exports = namespace.parseURI = function (url) {
var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);

@@ -5,0 +11,0 @@ return m ? {

@@ -1,3 +0,4 @@

/*can-parse-uri@1.0.0#can-parse-uri*/
module.exports = function (url) {
/*can-parse-uri@1.0.2#can-parse-uri*/
var namespace = require('can-namespace');
module.exports = namespace.parseURI = function (url) {
var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);

@@ -4,0 +5,0 @@ return m ? {

@@ -123,3 +123,8 @@ /*[global-shim-start]*/

{},
typeof self == "object" && self.Object == Object ? self : window,
typeof self == "object" && self.Object == Object
? self
: typeof process === "object" &&
Object.prototype.toString.call(process) === "[object process]"
? global
: window,
function(__$source__, __$global__) {

@@ -131,5 +136,11 @@ // jshint ignore:line

/*can-parse-uri@1.0.0#can-parse-uri*/
define('can-parse-uri', function (require, exports, module) {
module.exports = function (url) {
/*can-parse-uri@1.0.2#can-parse-uri*/
define('can-parse-uri', [
'require',
'exports',
'module',
'can-namespace'
], function (require, exports, module) {
var namespace = require('can-namespace');
module.exports = namespace.parseURI = function (url) {
var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);

@@ -154,2 +165,2 @@ return m ? {

}
)(typeof self == "object" && self.Object == Object ? self : window);
)(typeof self == "object" && self.Object == Object ? self : (typeof process === "object" && Object.prototype.toString.call(process) === "[object process]") ? global : window);
{
"name": "can-parse-uri",
"version": "1.0.1",
"version": "1.1.0",
"description": "Parse a URI into its components.",

@@ -29,3 +29,3 @@ "homepage": "https://canjs.com/",

},
"main": "dist/cjs/can-parse-uri",
"main": "can-parse-uri",
"keywords": [

@@ -48,8 +48,7 @@ "canjs",

},
"dependencies": {},
"dependencies": {
"can-namespace": "^1.0.0"
},
"devDependencies": {
"detect-cyclic-packages": "^1.1.0",
"done-serve": "^1.0.0",
"donejs-cli": "^1.0.0",
"generator-donejs": "^1.0.0",
"jshint": "^2.9.1",

@@ -56,0 +55,0 @@ "steal": "^1.3.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc