can-parse-uri
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -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", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
16097
6
276
1
15
2
+ Addedcan-namespace@^1.0.0
+ Addedcan-namespace@1.0.0(transitive)