diff --git a/types/urijs/index.d.ts b/types/urijs/index.d.ts index ea56ef9610..64d048a6a7 100644 --- a/types/urijs/index.d.ts +++ b/types/urijs/index.d.ts @@ -89,8 +89,10 @@ declare namespace uri { relativeTo(path: string): URI; removeQuery(qry: string): URI; removeQuery(qry: Object): URI; + removeQuery(name: string, value: string): URI; removeSearch(qry: string): URI; removeSearch(qry: Object): URI; + removeSearch(name: string, value: string): URI; resource(): string; resource(resource: string): URI; diff --git a/types/urijs/urijs-tests.ts b/types/urijs/urijs-tests.ts index 12c853d8b4..f520f0eaca 100644 --- a/types/urijs/urijs-tests.ts +++ b/types/urijs/urijs-tests.ts @@ -95,3 +95,19 @@ uri.hasQuery(/^li/, "two") === true; uri.hasQuery("string", (value : string, name : string, data : string) => { return true; }) === true; + +/* +Tests for removeSearch() +From: https://medialize.github.io/URI.js/docs.html#search-remove +*/ +var uri = new URI("?hello=world&hello=mars&foo=bar"); +uri.removeSearch("hello"); +uri.search(true) === "?foo=bar"; + +uri.search("?hello=world&hello=mars&foo=bar"); +uri.removeSearch("hello", "world"); +uri.search(true) === "?hello=mars&foo=bar" + +uri.search("?hello=world&hello=mars&foo=bar&mine=true"); +uri.removeSearch(["hello", "foo"]); +uri.search(true) === "?mine=true"