[BREAKING] Plugin: summary --> summarize (2.0.0)

This commit is contained in:
syuilo
2017-02-08 14:31:04 +09:00
parent 6dfe2912a3
commit 10356019ed
6 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2.0.0 / 2017-02-08
------------------
* **[BREAKING CHANGE] Renamed: Plugins: Method `summary` is now `summarize`**
* Some refactors
1.6.1 / 2017-02-06
------------------
* Fix the incorrect type definition

View File

@ -1,6 +1,6 @@
{
"name": "summaly",
"version": "1.6.1",
"version": "2.0.0",
"description": "Get web page's summary",
"author": "syuilo <i@syuilo.com>",
"license": "MIT",

View File

@ -60,7 +60,7 @@ export default async (url: string, options?: Options): Promise<Result> => {
const match = plugins.filter(plugin => plugin.test(_url))[0];
// Get summary
const summary = await (match ? match.summary : general)(_url);
const summary = await (match ? match.summarize : general)(_url);
return Object.assign(summary, {
url: actualUrl

View File

@ -3,7 +3,7 @@ import Summary from './summary';
interface IPlugin {
test: (url: URL.Url) => boolean;
summary: (url: URL.Url) => Promise<Summary>;
summarize: (url: URL.Url) => Promise<Summary>;
}
export default IPlugin;

View File

@ -21,7 +21,7 @@ export function test(url: URL.Url) {
url.hostname === 'www.amazon.au'
};
export async function summary(url: URL.Url) {
export async function summarize(url: URL.Url) {
const res = await client.fetch(url.href);
const $ = res.$;

View File

@ -9,7 +9,7 @@ export function test(url: URL.Url) {
return /\.wikipedia\.org$/.test(url.hostname);
};
export function summary(url: URL.Url) {
export function summarize(url: URL.Url) {
return new Promise((res, rej) => {
const lang = url.host.split('.')[0];
const title = url.pathname.split('/')[2];