You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I still can't believe javascript - the f**ing backbone-language of the web - doesn't offer an API for mutating URLs. Browsers (Firefox) don't expose the `Location` object (the structure behind window.location). Yes, one could think of [decomposed IDL attributes](http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#url-decomposition-idl-attributes) as a native URL management library. But it relies on the DOM element <a>, it's slow and doesn't offer any convenience at all.
21
-
22
-
How about a nice, clean and simple API for mutating URIs:
24
+
Things are looking up with [URL](https://developer.mozilla.org/en/docs/Web/API/URL) and the [URL spec](http://url.spec.whatwg.org/) but until we can safely rely on that API, have a look at URI.js for a clean and simple API for mutating URIs:
23
25
24
26
```javascript
25
27
var url =newURI("http://example.org/foo?bar=baz");
@@ -79,20 +81,14 @@ See the [About Page](http://medialize.github.io/URI.js/) and [API Docs](http://m
79
81
80
82
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).
81
83
82
-
URI.js is available through [npm](http://npmjs.org/), [bower](http://bower.io/), [Jam](http://jamjs.org/), [spm](http://spmjs.io/) and manually from the [build page](http://medialize.github.io/URI.js/build.html):
84
+
URI.js is available through [npm](https://www.npmjs.com/package/urijs), [bower](http://bower.io/search/?q=urijs), [cdnjs](https://cdnjs.com/libraries/URI.js) and manually from the [build page](http://medialize.github.io/URI.js/build.html):
83
85
84
86
```bash
85
87
# using bower
86
88
bower install uri.js
87
89
88
-
# using Jam
89
-
jam install URIjs
90
-
91
90
# using npm
92
-
npm install URIjs
93
-
94
-
# using spm
95
-
spm install urijs
91
+
npm install urijs
96
92
```
97
93
98
94
### Browser ###
@@ -101,13 +97,13 @@ I guess you'll manage to use the [build tool](http://medialize.github.io/URI.js/
101
97
102
98
### Node.js and NPM ###
103
99
104
-
Install with `npm install URIjs` or add `"URIjs"` to the dependencies in your `package.json`.
100
+
Install with `npm install urijs` or add `"urijs"` to the dependencies in your `package.json`.
105
101
106
102
```javascript
107
103
// load URI.js
108
-
varURI=require('URIjs');
104
+
varURI=require('urijs');
109
105
// load an optional module (e.g. URITemplate)
110
-
var URITemplate =require('URIjs/src/URITemplate');
106
+
var URITemplate =require('urijs/src/URITemplate');
111
107
112
108
URI("/foo/bar/baz.html")
113
109
.relativeTo("/foo/bar/sub/world.html")
@@ -121,14 +117,14 @@ Clone the URI.js repository or use a package manager to get URI.js into your pro
121
117
```javascript
122
118
require.config({
123
119
paths: {
124
-
URIjs:'where-you-put-uri.js/src'
120
+
urijs:'where-you-put-uri.js/src'
125
121
}
126
122
});
127
123
128
-
require(['URIjs/URI'], function(URI) {
124
+
require(['urijs/URI'], function(URI) {
129
125
console.log("URI.js and dependencies: ", URI("//amazon.co.uk").is('sld') ?'loaded':'failed');
*[URI.js by Gary Court](https://github.com/garycourt/uri-js)
211
207
212
208
#### URI Template ####
@@ -244,6 +240,13 @@ URI.js is published under the [MIT license](http://www.opensource.org/licenses/m
244
240
245
241
## Changelog ##
246
242
243
+
### 1.16.1 (September 19th 2015) ###
244
+
245
+
Package Management Cleanup - no changes to source code!
246
+
247
+
* renaming package to "urijs", was "URIjs" (because npm decided to go lower-case at some point and maintaining capitals in your package name poses all sorts of stupid issues)
248
+
* removing [jam](http://jamjs.org/), [spm](http://spmjs.org/), `component.json` and `URI.jquery.json` as nobody cared that URI.js was stuck on 1.14 for a year
249
+
247
250
### 1.16.0 (July 24th 2015) ###
248
251
249
252
***SECURITY** fixing [`URI.parseHost()`](http://medialize.github.io/URI.js/docs.html#static-parseHost) to rewrite `\` to `/` as Node and Browsers do - [Issue #233](https://github.com/medialize/URI.js/pull/233)
0 commit comments