Adds segmentCoded method to URIjs types

This commit is contained in:
David Brooks
2017-03-28 13:08:02 +01:00
parent d2d933019a
commit 8f8edb85f5
2 changed files with 9 additions and 0 deletions

View File

@@ -104,6 +104,11 @@ declare namespace uri {
segment(position: number): string;
segment(position: number, level: string): URI;
segment(segment: string): URI;
segmentCoded(): string[];
segmentCoded(segments: string[]): URI;
segmentCoded(position: number): string;
segmentCoded(position: number, level: string): URI;
segmentCoded(segment: string): URI;
setQuery(key: string, value: string): URI;
setQuery(qry: Object): URI;
setSearch(key: string, value: string): URI;

View File

@@ -39,6 +39,10 @@ URI('http://example.org/foo/hello.html').segment('bar');
URI('http://example.org/foo/hello.html').segment(0, 'bar');
URI('http://example.org/foo/hello.html').segment(['foo', 'bar', 'foobar.html']);
URI('http://example.org/foo/hello.html').segmentCoded('foo bar');
URI('http://example.org/foo/hello.html').segmentCoded(0, 'foo bar');
URI('http://example.org/foo/hello.html').segmentCoded(['foo bar', 'bar foo', 'foo bar.html']);
var withDuplicates = URI("?bar=1&bar=1")
.duplicateQueryParameters(true)
.normalizeQuery()