forked from shmuelie/Humanizer.Js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
numberToWordsExtension.js
27 lines (27 loc) · 1.39 KB
/
numberToWordsExtension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var Humanizer;
(function (Humanizer) {
"use strict";
/**
* 3501.ToWords() -> "three thousand five hundred and one"
*/
Number.prototype.toWords = function () {
/// <summary>
/// 3501.ToWords() -> "three thousand five hundred and one"
/// </summary>
var gender = arguments.length >= 1 && typeof arguments[0] === "number" ? arguments[0] : null;
var converter = Humanizer.Configuration.Configurator.getNumberToWordsConverter(arguments.length > 0 && typeof arguments[arguments.length - 1] === "string" ? arguments[arguments.length - 1] : Humanizer.Resources.getCurrentCulture());
if (gender === null) {
return converter.convert(this);
}
return converter.convert(this, gender);
};
Number.prototype.toOrdinalWords = function () {
var gender = arguments.length >= 1 && typeof arguments[0] === "number" ? arguments[0] : null;
var converter = Humanizer.Configuration.Configurator.getNumberToWordsConverter(arguments.length > 0 && typeof arguments[arguments.length - 1] === "string" ? arguments[arguments.length - 1] : Humanizer.Resources.getCurrentCulture());
if (gender === null) {
return converter.convertToOrdinal(this);
}
return converter.convertToOrdinal(this, gender);
};
})(Humanizer || (Humanizer = {}));
//# sourceMappingURL=numberToWordsExtension.js.map