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) {