From 33132b2ba2744835c52b72da4c4c8b854b0d2045 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 13 Sep 2016 06:02:27 +0900 Subject: [PATCH] Fix bug --- README.md | 2 +- src/index.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8f51c23..ea2a526 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Installation Usage ----- -`(url: string, opts: Options) => Promise` +`(url: string, options: Options) => Promise` ### Options | Property | Type | Description | Default | diff --git a/src/index.ts b/src/index.ts index e5a0759..d3d9d92 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,9 +11,14 @@ const plugins: IPlugin[] = [ require('./plugins/wikipedia') ]; -export default async (url: string, opts: Options): Promise => { +export default async (url: string, options?: Options): Promise => { const _url = URL.parse(url, true); + const opts: any = options || {}; + if (!opts.hasOwnProperty('proxy')) { + opts.proxy = null; + } + const plugin = plugins.filter(plugin => plugin.test(_url))[0]; if (plugin) {