* expose `urijs/src/URITemplate`
* expand `equals(url: string): boolean;` to `equals(url: string | URI): boolean;`
This commit is contained in:
alexander-matsievsky
2016-01-25 16:47:49 +03:00
parent 7b3d5a6ea5
commit a44bf5bad7
2 changed files with 24 additions and 3 deletions

View File

@@ -42,4 +42,21 @@ URI('http://example.org/foo/hello.html').segment(['foo', 'bar', 'foobar.html']);
var withDuplicates = URI("?bar=1&bar=1")
.duplicateQueryParameters(true)
.normalizeQuery()
.toString();
.toString();
/*
To enable `URI.expand` when using `URI.js` via `npm`, include the following:
```
import * as URI from "urijs";
import * as URITemplate from "urijs/src/URITemplate";
void URITemplate;
```
*/
URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag').equals(
URI.expand('http://user:pass@example.org:80{/p*}{?q*}{#h}', {
p: ["foo", "bar.html"],
q: {foo: "bar", bar: "baz"},
h: "frag"
})
);

8
urijs/URIjs.d.ts vendored
View File

@@ -27,11 +27,11 @@ declare module uri {
domain(): string;
domain(domain: boolean): string;
domain(domain: string): URI;
duplicateQueryParameters(val: boolean): URI;
equals(): boolean;
equals(url: string): boolean;
equals(url: string | URI): boolean;
filename(): string;
filename(file: boolean): string;
@@ -234,3 +234,7 @@ declare module 'URI' {
declare module 'urijs' {
export = URI;
}
declare module 'urijs/src/URITemplate' {
export = URI;
}