Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

URIjs

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

URIjs - npm Package Compare versions

Comparing version 1.11.0 to 1.11.1

7

package.json
{
"name": "URIjs",
"version": "1.11.0",
"version": "1.11.1",
"title": "URI.js - Mutating URLs",

@@ -9,2 +9,7 @@ "author": {

},
"repository" :
{
"type" : "git",
"url" : "https://github.com/medialize/URI.js.git"
},
"licenses": [

@@ -11,0 +16,0 @@ {

95

README.md

@@ -14,4 +14,4 @@ # URI.js #

```javascript
var url = "http://example.org/foo?bar=baz",
separator = url.indexOf('?') > -1 ? '&' : '?';
var url = "http://example.org/foo?bar=baz";
var separator = url.indexOf('?') > -1 ? '&' : '?';

@@ -38,32 +38,32 @@ url += separator + encodeURIComponent("foo") + "=" + encodeURIComponent("bar");

URI("http://example.org/foo.html?hello=world")
.username("rodneyrehm")
// -> http://rodneyrehm@example.org/foo.html?hello=world
.username("")
// -> http://example.org/foo.html?hello=world
.directory("bar")
// -> http://example.org/bar/foo.html?hello=world
.suffix("xml")
// -> http://example.org/bar/foo.xml?hello=world
.query("")
// -> http://example.org/bar/foo.xml
.tld("com")
// -> http://example.com/bar/foo.xml
.query({ foo: "bar", hello: ["world", "mars"] });
// -> http://example.com/bar/foo.xml?foo=bar&hello=world&hello=mars
.username("rodneyrehm")
// -> http://rodneyrehm@example.org/foo.html?hello=world
.username("")
// -> http://example.org/foo.html?hello=world
.directory("bar")
// -> http://example.org/bar/foo.html?hello=world
.suffix("xml")
// -> http://example.org/bar/foo.xml?hello=world
.query("")
// -> http://example.org/bar/foo.xml
.tld("com")
// -> http://example.com/bar/foo.xml
.query({ foo: "bar", hello: ["world", "mars"] });
// -> http://example.com/bar/foo.xml?foo=bar&hello=world&hello=mars
// cleaning things up
URI("?&foo=bar&&foo=bar&foo=baz&")
.normalizeQuery();
// -> ?foo=bar&foo=baz
.normalizeQuery();
// -> ?foo=bar&foo=baz
// working with relative paths
URI("/foo/bar/baz.html")
.relativeTo("/foo/bar/world.html");
// -> ./baz.html
.relativeTo("/foo/bar/world.html");
// -> ./baz.html
URI("/foo/bar/baz.html")
.relativeTo("/foo/bar/sub/world.html")
// -> ../baz.html
.absoluteTo("/foo/bar/sub/world.html");
// -> /foo/bar/baz.html
.relativeTo("/foo/bar/sub/world.html")
// -> ../baz.html
.absoluteTo("/foo/bar/sub/world.html");
// -> /foo/bar/baz.html

@@ -82,2 +82,17 @@ // URI Templates

URI.js (without plugins) has a gzipped weight of about 7KB - if you include all extensions you end up at about 13KB. So unless you *need* second level domain support and use URI templates, we suggest you don't include them in your build. If you don't need a full featured URI mangler, it may be worth looking into the much smaller parser-only alternatives [listed below](#alternatives).
URI.js is available through [npm](http://npmjs.org/), [bower](http://bower.io/), [Jam](http://jamjs.org/) and manually from the [build page](http://medialize.github.io/URI.js/build.html):
```bash
# using bower
bower install uri.js
# using Jam
jam install URIjs
# using npm
npm install URIjs
```
### Browser ###

@@ -98,4 +113,4 @@

URI("/foo/bar/baz.html")
.relativeTo("/foo/bar/sub/world.html")
// -> ../baz.html
.relativeTo("/foo/bar/sub/world.html")
// -> ../baz.html
```

@@ -109,12 +124,12 @@

require.config({
paths: {
URIjs: 'where-you-put-uri.js/src'
}
paths: {
URIjs: 'where-you-put-uri.js/src'
}
});
require(['URIjs/URI'], function(URI) {
console.log("URI.js and dependencies: ", URI("//amazon.co.uk").is('sld') ? 'loaded' : 'failed');
console.log("URI.js and dependencies: ", URI("//amazon.co.uk").is('sld') ? 'loaded' : 'failed');
});
require(['URIjs/URITemplate'], function(URITemplate) {
console.log("URITemplate.js and dependencies: ", URITemplate._cache ? 'loaded' : 'failed');
console.log("URITemplate.js and dependencies: ", URITemplate._cache ? 'loaded' : 'failed');
});

@@ -166,3 +181,3 @@ ```

If you don't like URI.js, you may like one of these:
If you don't like URI.js, you may like one of the following libraries. (If yours is not listed, drop me a line…)

@@ -196,3 +211,3 @@ #### URL Manipulation ####

* [TLD.js](https://github.com/oncletom/tld.js) - second level domain names
* [Public Suffic](http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1) - second level domain names
* [Public Suffix](http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1) - second level domain names

@@ -202,2 +217,3 @@ ## Authors ##

* [Rodney Rehm](https://github.com/rodneyrehm)
* [Various Contributors](https://github.com/medialize/URI.js/graphs/contributors)

@@ -218,2 +234,9 @@

### 1.11.1 (August 13th 2013) ###
* fixing inconsistent [`.relativeTo()`](http://medialize.github.com/URI.js/docs.html#relativeto) results caused by inconsistent URI component handling - ([Issue #103](https://github.com/medialize/URI.js/issues/103))
* fixing unsafe eval by using UMD's root - ([Issue #105](https://github.com/medialize/URI.js/issues/105))
* fixing [`.segment()`](http://medialize.github.com/URI.js/docs.html#accessors-segment) to allow appending an empty element - ([Issue #106](https://github.com/medialize/URI.js/issues/106))
* fixing [`.segment()`](http://medialize.github.com/URI.js/docs.html#accessors-segment) to collapse empty elements in array notation
### 1.11.0 (August 6th 2013) ###

@@ -224,3 +247,3 @@

* removing obsolete code fragments from `URI.parse()` and `relativeTo()` - ([Issue #100](https://github.com/medialize/URI.js/issues/100))
* adding setting `URI.escapeQuerySpace` to control if query string should escape spaces using `+` or `%20` - ([Issue #74](https://github.com/medialize/URI.js/issues/74))
* adding setting [`URI.escapeQuerySpace`](http://medialize.github.io/URI.js/docs.html#setting-escapeQuerySpace) to control if query string should escape spaces using `+` or `%20` - ([Issue #74](https://github.com/medialize/URI.js/issues/74))
* updating [Punycode.js](https://github.com/bestiejs/punycode.js/) to version 1.2.3

@@ -236,3 +259,3 @@ * fixing internal `strictEncodeURIComponent()` to work in Firefox 3.6 - ([Issue #91](https://github.com/medialize/URI.js/issues/91))

* fixing [`.readable()`](http://medialize.github.com/URI.js/docs.html#readable) to decode the hash value as well - ([Issue #90](https://github.com/medialize/URI.js/issue/90))
* prevent `jquery.URI.js from` temporarily using `window.location` as the `href` of an empty attribute of a DOM element - ([Issue #94](https://github.com/medialize/URI.js/issues/94))
* prevent `jquery.URI.js` from temporarily using `window.location` as the `href` of an empty attribute of a DOM element - ([Issue #94](https://github.com/medialize/URI.js/issues/94))
* fixing internal `getType()` for IE8 with undefined value - ([Issue #96](https://github.com/medialize/URI.js/issues/96))

@@ -258,3 +281,3 @@ * adding DOM elements to [URI constructor](http://medialize.github.io/URI.js/docs.html#constructor) - ([Issue #77](https://github.com/medialize/URI.js/issues/77)):

* fixing [`relativeTo()`](http://medialize.github.com/URI.js/docs.html#relativeto) - ([Issue #75](https://github.com/medialize/URI.js/issues/75))
* fixing [`normalizePath()`](http://medialize.github.com/URI.js/docs.html#normalize-path) to not prepend ./ to relative paths - ([Issue #76](https://github.com/medialize/URI.js/issues/76))
* fixing [`normalizePath()`](http://medialize.github.com/URI.js/docs.html#normalize-path) to not prepend `./` to relative paths - ([Issue #76](https://github.com/medialize/URI.js/issues/76))

@@ -261,0 +284,0 @@ ### 1.10.1 (April 2nd 2013) ###

@@ -5,3 +5,3 @@ /*!

*
* Version: 1.11.0
* Version: 1.11.1
*

@@ -26,5 +26,5 @@ * Author: Rodney Rehm

// Browser globals (root is window)
root.IPv6 = factory();
root.IPv6 = factory(root);
}
}(this, function () {
}(this, function (root) {
"use strict";

@@ -40,5 +40,2 @@

// get access to the global object ('window' in browsers)
var root = (function(f){ return f('return this')(); })(Function);
// save current IPv6 variable, if any

@@ -45,0 +42,0 @@ var _IPv6 = root.IPv6;

@@ -5,3 +5,3 @@ /*!

*
* Version: 1.11.0
* Version: 1.11.1
*

@@ -8,0 +8,0 @@ * Author: Rodney Rehm

@@ -5,3 +5,3 @@ /*!

*
* Version: 1.11.0
* Version: 1.11.1
*

@@ -27,10 +27,7 @@ * Author: Rodney Rehm

// Browser globals (root is window)
root.SecondLevelDomains = factory();
root.SecondLevelDomains = factory(root);
}
}(this, function () {
}(this, function (root) {
"use strict";
// get access to the global object ('window' in browsers)
var root = (function(f){ return f('return this')(); })(Function);
// save current SecondLevelDomains variable, if any

@@ -37,0 +34,0 @@ var _SecondLevelDomains = root.SecondLevelDomains;

/*!
* URI.js - Mutating URLs
*
* Version: 1.11.0
* Version: 1.11.1
*

@@ -24,10 +24,7 @@ * Author: Rodney Rehm

// Browser globals (root is window)
root.URI = factory(root.punycode, root.IPv6, root.SecondLevelDomains);
root.URI = factory(root.punycode, root.IPv6, root.SecondLevelDomains, root);
}
}(this, function (punycode, IPv6, SLD) {
}(this, function (punycode, IPv6, SLD, root) {
"use strict";
// get access to the global object ('window' in browsers)
var root = (function(f){ return f('return this')(); })(Function);
// save current URI variable, if any

@@ -385,3 +382,3 @@ var _URI = root.URI;

// relative-scheme
parts.protocol = '';
parts.protocol = null;
string = string.substring(2);

@@ -393,3 +390,3 @@ // extract "user:pass@host:port"

if (pos > -1) {
parts.protocol = string.substring(0, pos);
parts.protocol = string.substring(0, pos) || null;
if (parts.protocol && !parts.protocol.match(URI.protocol_expression)) {

@@ -842,3 +839,3 @@ // : may be within the path

} else {
this._parts[_part] = v;
this._parts[_part] = v || null;
this.build(!build);

@@ -1424,4 +1421,16 @@ return this;

if (isArray(v)) {
segments = v;
} else if (v || (typeof v === "string" && v.length)) {
segments = [];
// collapse empty elements within array
for (var i=0, l=v.length; i < l; i++) {
if (!v[i].length && (!segments.length || !segments[segments.length -1].length)) {
continue;
}
if (segments.length && !segments[segments.length -1].length) {
segments.pop();
}
segments.push(v[i]);
}
} else if (v || (typeof v === "string")) {
if (segments[segments.length -1] === "") {

@@ -1428,0 +1437,0 @@ // empty trailing elements have to be overwritten

@@ -5,3 +5,3 @@ /*!

*
* Version: 1.11.0
* Version: 1.11.1
*

@@ -26,10 +26,7 @@ * Author: Rodney Rehm

// Browser globals (root is window)
root.URITemplate = factory(root.URI);
root.URITemplate = factory(root.URI, root);
}
}(this, function (URI) {
}(this, function (URI, root) {
"use strict";
// get access to the global object ('window' in browsers)
var root = (function(f){ return f('return this')(); })(Function);
// save current URITemplate variable, if any

@@ -36,0 +33,0 @@ var _URITemplate = root.URITemplate;

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc