plural-ro

1.0.0 • Public • Published

plural-ro

Build Status

Automatically display the correct form of the nouns in the romanian language when counted.

Installation

As npm package

npm i -S plural-ro

Explanation

In compound numerals bigger than 100, the elements form a simple string without a connector : 101 – o sută unu, 113 – o sută treisprezece, 1.025 – o mie douăzeci şi cinci, 1.003 – o mie trei, 1.019 – o mie nouăsprezece, 1.037 – o mie treizeci şi şapte, 1.245 – o mie două sute patruzeci şi cinci, etc. The preposition de after numerals over 100 is not required if the numeral in the final position is not bigger that 19 (such as: 101 o sută unu, 206 două sute şase, 1.018 o mie optsprezece, 3.519 trei mii cinci sute nouăsprezece): 105 cărţi – o sută cinci cărţi, 1319 cărţi – o mie trei sute nouăsprezece cărţi, etc. If a numeral between 20 and 99 is in the final position, the preposition de must be used : 120 de cărţi – o sută douăzeci de cărţi, 1322 de cărţi – o mie trei sute douăzeci şi două de cărţi, etc.

Romanian Grammar by Dana Cojocaru

Usage

Basic usage

const pluralro = require('plural-ro').pluralro;
// import { pluralro } from 'plural-ro';
 
pluralro(1, 'obliect', 'obiecte'); // 1 obliect
pluralro(1, 'obliect', 'obiecte', 'n'); // un obliect
pluralro(1, 'obliect', 'obiecte', 'n', true); // Un obliect
 
pluralro(123, 'sticla', 'sticle'); // 123 de sticle
pluralro(1, 'sticla', 'sticle', 'f'); // o sticla
pluralro(1, 'sticla', 'sticle', 'f', true); // O sticla

API

Functions

de(number)boolean

Appends "de" preposition if a numeral between 20 and 99 is in the final position.

pluralro(count, singularWord, pluralWord, replaceOne, ucfirst)string

Automatically display the correct form of the nouns in the romanian language when counted.

de(number) ⇒ boolean

Appends "de" preposition if a numeral between 20 and 99 is in the final position.

Kind: global function
Returns: boolean - If should append "de" preposition

Param
number

pluralro(count, singularWord, pluralWord, replaceOne, ucfirst) ⇒ string

Automatically display the correct form of the nouns in the romanian language when counted.

Kind: global function

Param Type Default Description
count number Count
singularWord string Singular form
pluralWord string Plural form
replaceOne string | boolean false The gender of the noun
ucfirst boolean false

You may also want to try inttorowords for converting numbers into romanian words.


License

MIT

/plural-ro/

    Package Sidebar

    Install

    npm i plural-ro

    Weekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    8.04 kB

    Total Files

    7

    Last publish

    Collaborators

    • alexcambose