From 52448f351d7b0882ac67e2974b93c1e730f5dbb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=B7=E6=B8=A1?= Date: Fri, 14 Jun 2019 23:46:07 +0800 Subject: feat: URLSearchParams should work with custom iterator (#2512) --- js/url_search_params.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'js/url_search_params.ts') diff --git a/js/url_search_params.ts b/js/url_search_params.ts index 85f4c0619..666ba6951 100644 --- a/js/url_search_params.ts +++ b/js/url_search_params.ts @@ -1,6 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import { URL } from "./url"; -import { requiredArguments } from "./util"; +import { requiredArguments, isIterable } from "./util"; export class URLSearchParams { private params: Array<[string, string]> = []; @@ -17,6 +17,11 @@ export class URLSearchParams { return; } + if (isIterable(init)) { + this.params = [...init]; + return; + } + if (Object(init) !== init) { return; } -- cgit v1.2.3