mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-05-07 22:57:16 +09:00
Refactor
This commit is contained in:
parent
aa5384ad62
commit
d0ec1db164
10
src/index.ts
10
src/index.ts
@ -37,6 +37,11 @@ type Result = Summary & {
|
||||
url: string;
|
||||
};
|
||||
|
||||
const defaultOptions = {
|
||||
followRedirects: true,
|
||||
plugins: null
|
||||
} as Options;
|
||||
|
||||
/**
|
||||
* Summarize an web page
|
||||
* @param {string} url URL of web page you want to summarize
|
||||
@ -44,10 +49,7 @@ type Result = Summary & {
|
||||
* @return {Promise<Result>} Promised summary
|
||||
*/
|
||||
export default async (url: string, options?: Options): Promise<Result> => {
|
||||
const opts = Object.assign({
|
||||
followRedirects: true,
|
||||
plugins: null
|
||||
}, options) as Options;
|
||||
const opts = Object.assign(defaultOptions, options);
|
||||
|
||||
const plugins = builtinPlugins.concat(opts.plugins || []);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user