Skip to content

💭 Easy Node.js module that, generates grammatically messages based on numeric input. Extensible, supports localization. Fast performance.

License

Notifications You must be signed in to change notification settings

makarasty/ezplural

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ezplural

💭 A lightweight Node.js module that dynamically generates grammatically correct messages based on numerical input. It's designed to be easily extensible and supports localization. The module prioritizes fast performance for efficient processing

Install

npm i ezplural

Example 0

const getEzPlural = require('ezplural')
const pack = ['слово', 'слова', 'слів']

getEzPlural(1, pack) // 'слово'
getEzPlural(34, pack) // 'слова'
getEzPlural(45, pack) // 'слів'

Example 1

const getEzPlural = require('ezplural')
const pack = ['text', 'texts']

getEzPlural(1, pack) // 'text'
getEzPlural(34, pack) // 'texts'
getEzPlural(45, pack) // 'texts'

Example 2

const getEzPlural = require('ezplural')
const pack = ['сообщения', 'сообщения', 'сообщений']

getEzPlural(1, pack) // 'сообщения'
getEzPlural(34, pack) // 'сообщения'
getEzPlural(45, pack) // 'сообщений'

Important

It works too simply, don't expect perfect results, but it's very fast 😋

About

💭 Easy Node.js module that, generates grammatically messages based on numeric input. Extensible, supports localization. Fast performance.

Resources

License

Stars

Watchers

Forks