SiteWebAstrolabe/src/_data/helpers.js
2020-06-19 23:47:44 +02:00

11 lines
275 B
JavaScript

module.exports = {
getNextHeadingLevel(currentLevel) {
return parseInt(currentLevel, 10) + 1;
},
getReadingTime(text) {
const wordsPerMinute = 200;
const numberOfWords = text.split(/\s/g).length;
return Math.ceil(numberOfWords / wordsPerMinute);
}
};