-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnode-icu-transliterator.js
42 lines (34 loc) · 1.13 KB
/
node-icu-transliterator.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
let native = require('bindings')('node-icu-transliterator');
let RBT = function RBT(id, dir) {
if (id === undefined) throw 'missing id parameter';
if (dir === undefined) dir = RBT.FORWARD;
return new native.RBT(1, id, dir);
}
RBT.fromRules = function(rules, dir) {
if (rules === undefined) throw 'missing rules parameter';
if (dir === undefined) dir = RBT.FORWARD;
return new native.RBT(2, rules, dir);
}
RBT.register = function(id, rules, dir) {
if (id === undefined) throw 'missing id parameter';
if (rules === undefined) throw 'missing rules parameter';
if (dir === undefined) dir = RBT.FORWARD;
native.RBT.register(id, rules, dir);
}
RBT.FORWARD = true;
RBT.REVERSE = false;
let RBNF = function RBNF(language, tag) {
if (language === undefined) throw 'missing language parameter';
if (tag === undefined) tag = RBNF.SPELLOUT;
return new native.RBNF(language, tag);
}
RBNF.fromRules = function(rules) {
if (rules === undefined) throw 'missing rules parameter';
return new native.RBNF(rules);
}
RBNF.SPELLOUT = 0;
RBNF.ORDINAL = 1;
RBNF.DURATION = 2;
RBNF.NUMBERING_SYSTEM = 3;
exports.RBT = RBT;
exports.RBNF = RBNF;