mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-31 03:02:04 +08:00
add type for removeSearch(name, value) (#18451)
This commit is contained in:
2
types/urijs/index.d.ts
vendored
2
types/urijs/index.d.ts
vendored
@@ -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;
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user