diff --git a/urijs/URIjs-tests.ts b/urijs/URIjs-tests.ts index 0f529fe4a0..2e1e1eacd4 100644 --- a/urijs/URIjs-tests.ts +++ b/urijs/URIjs-tests.ts @@ -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(); \ No newline at end of file + .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" + }) +); diff --git a/urijs/URIjs.d.ts b/urijs/URIjs.d.ts index 23d79218b6..a7ab002bc7 100644 --- a/urijs/URIjs.d.ts +++ b/urijs/URIjs.d.ts @@ -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; +}