1.2.1 • Published 7 years ago
time-my-words v1.2.1
Text to time library for node.
Installation
Installation is done using the
npm install
command:
$ npm install time-my-words
Examples
Time
The time funcion estimates the time spent reading the input(inserted) text.
var tmw = require('time-my-words');
var result = tmw.time('A lot of text');
// result = 00:04:32
Configuration Object
The output can be configured adding a configuration object as the second parameter of the time function. The three configurable options are language(lang),label (label), and the position of the label (label_position).
var tmw = require('time-my-words');
var result = tmw.time('A lot of text', {
lang: 'en',
label: 'read',
label_position: 'end'
});
// result = 4 minutes read
Available languages for the moment:
- English (en)
- Spanish (es)
Format
The format function is the isolated equivalent to adding a configuration object in the time function.
var tmw = require('time-my-words');
var result = tmw.time('A lot of text');
result = tmw.format(result, {
lang: 'en',
label: 'read',
label_position: 'end'
});
// result = 4 minutes read