Home wolsey

Wolsey

var Wolsey - require("wolsey");
var cardinal = new Wolsey();

Output numbers as numerals and ordinals

Version

0.1.1

Installation

npm install wolsey

Instance methods

numeral

Convert a number to words

var converted = cardinal.numeral(num, options);

See wolsey#numeral

ordinal

Convert a number to its ordinal form in words

var converted = cardinal.ordinal(num, options);

See wolsey#ordinal

ordinalAsNumber

Convert a number to its numeric ordinal form

var converted = ordinalAscardinal.numeral(num, options);

See wolsey#ordinalAsNumber

addLang

Add a language to an existing Wolsey instance

cardinal.addLanguage(lang, methods);

See wolsey#addLanguage

Constructor

Create a Wolsey instance

var cardinal = new Wolsey(lang, methods);

See wolsey.Constructor

Static methods

LANG

Generic language factory method

var lang = Wolsey.LANG(options);

See wolsey.LANG

EN

Base English numbers methods

var en = WOLSEY.EN(options);

See wolsey.EN

Languages provided

French

require("wolsey/lang/fr");
var cardinal = new Wolsey("fr", Wolsey.FR());

See lang/fr

German

require("wolsey/lang/de");
var cardinal = new Wolsey("de", Wolsey.DE());

See lang/de

Spanish

require("wolsey/lang/es");
var cardinal = new Wolsey("es", Wolsey.ES());

See lang/es

To add a language to an existing Wolsey instance

cardinal.addLanguage("fr", Wolsey.FR());

Tests

npm test

To see output generated by tests

npm run test:output