node-glvrd
v0.2.0
Published
Nodejs wrapper for glvrd.ru API
Downloads
25
Readme
node-glvrd - WIP (разрабатывается, пользоваться нельзя)
Библиотека для подключения ко второй версии API Главреда. Берет на себя детали реализации, вам останется только подключить ее в node-приложение. Работает только для серверов.
// before all run: npm i -S node-glvrd
import nodeGlvrd from 'node-glvrd';
var glvrd = new nodeGlvrd('Your app name/1.0');
glvrd.proofread('Текст!!!').then(fragments => console.log(fragments));
// Result:
[
{
start: 1,
end: 2,
hint: {
id: 'r123456789',
name: 'Многократное восклицание',
description: 'Никогда не используйте более одного восклицательного знака подряд.'
}
},
…
]
API
new nodeGlvrd(appName)
appName
(обязательный, строка). Заранее регистрировать appName
не нужно, выбирайте любой разумный вариант. Предлагаемый формат и примеры значений: Super-duper/1.0
, GreatPlugin/0.2.3beta
, Example/0.1 (http://example.ru)
glvrd.checkStatus()
Проверит статус сервера Главреда, явно используйте только в разработке. Все сетевые ошибки node-glvrd
вернет в виде исключений (например, 500-й код http-ответа) или корректно обработает.
glvrd.proofread(text)
Требования
- Node.js 6 (более ранние версии зарабоютчерез Babel, а для 0.10 добавить полифил Promise)
Помощь
Лицензия
MIT © Aleksander Terekhov