Skip to content

Commit edf72f8

Browse files
committed
ဒဿမ
1 parent f482172 commit edf72f8

File tree

6 files changed

+28
-44
lines changed

6 files changed

+28
-44
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# myanmar-notation
22
...`get()` Myanmar digital and notation
33

4+
[![Build Status][travis]][travis-url]
5+
[![code style: prettier][prettier]][prettier-url]
6+
[![npm][npm-download]][npm-dl-url]
7+
[![contributions welcome][contri]][contri-url]
8+
[![License: MIT][license]][license-url]
9+
410
Install `npm i myanmar-notation` then require...
511

612

index.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1-
let notation = require('./notation');
1+
let myanmarNotation = require('./notation');
22
module.exports = {
33
get:function (q) {
4-
return new notation().get(q);
4+
return new myanmarNotation().get(q);
55
},
6-
// getCreaky:function (q) {
7-
// },
8-
// getNormal:function (q) {
9-
// },
106
name:function () {
11-
return new notation().configName();
7+
return new myanmarNotation().config.name;
128
},
139
digit:function () {
14-
return new notation().configDigit();
10+
return new myanmarNotation().config.digit;
1511
},
1612
tone:function () {
17-
return new notation().configTone();
13+
return new myanmarNotation().config.tone;
1814
},
1915
creaky:function () {
20-
return new notation().configCreaky();
16+
return new myanmarNotation().config.creaky;
2117
},
2218
conjunction:function () {
23-
return new notation().configConjunction();
19+
return new myanmarNotation().config.conjunction;
2420
}
2521
};

notation.js

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,10 @@ module.exports = class Notation {
66
// 1:"ခု",
77
tone:{1:"", 2:"ဆယ်", 3:"ရာ", 4:"ထောင်", 5:"သောင်း", 6:"သိန်း", 7:"သန်း", 8:"ကု​ဋေ​"},
88
creaky:{2:"ဆယ့်",3:"ရာ့",4:"ထောင့်"},
9-
conjunction:{space:" ",comma:"၊ ",and:"နှင့်",plus:"ပေါင်း",over:"ကျော်",times:"ကြိမ်"},
9+
conjunction:{space:" ",comma:"၊ ",and:"နှင့်",plus:"ပေါင်း",over:"ကျော်",times:"ကြိမ်":dot:"ဒဿမ"},
1010
task:[6,7,8]
1111
}
1212
}
13-
configName() {
14-
return this.config.name;
15-
}
16-
configDigit() {
17-
return this.config.digit;
18-
}
19-
configTone() {
20-
return this.config.tone;
21-
}
22-
configCreaky() {
23-
return this.config.creaky;
24-
}
25-
configConjunction() {
26-
return this.config.conjunction;
27-
}
2813
get(query) {
2914
let q=Math.floor(Number(query.toString().replace(/,\s?/g, ""))).toString(),t=0;
3015
if (isNaN(q)){
@@ -82,10 +67,10 @@ module.exports = class Notation {
8267
if (k && Number(k)){
8368
let ks = (s*2)-2;
8469
let kr = k.substring(0,ks);
85-
let kp = this.requestPrime(1,s);
8670
let k1 = this.requestWrittenTone(kr,0,s-1);
8771
let k2 = this.requestCreakyTone(kr,s-1,k1.length);
8872
if (k2){
73+
let kp = this.requestPrime(1,s);
8974
rawSense.push(kp+k1+' '+k2);
9075
} else {
9176
rawSense.push(k1);
@@ -108,21 +93,19 @@ module.exports = class Notation {
10893
examNotation={test:2};
10994
}
11095
} else {
111-
examNotation={ test:3, raw:raw};
11296
ruleExtract=rawCount-1+rawEndCount;
11397
rulePrime=2;
11498
if (ruleExtract > ruleMax){
11599
ruleExtract=rawEndCount-3;
116100
}
101+
examNotation={test:3, raw:raw};
117102
}
118103
return {
119104
sense:rawSenseName()//, exam: examNotation
120105
};
121106
}
122107
requestObject(str,callback) {
123108
let strCount = str.length, e=[];
124-
// let testing = this.config.tone.reverse()
125-
// let strReverse = str.reverse(); index += to, ++index
126109
for (let index = 0; index < strCount;++index){
127110
let position = strCount - index;
128111
let digit = str[index], next = index+1;
@@ -157,7 +140,7 @@ module.exports = class Notation {
157140
return k.name+k.tone;
158141
}).join(pair);
159142
}
160-
requestCreakyTail(num,from,to) {
143+
requestCreakyTail(num,from,to,pair=' ') {
161144
let str = this.strIntersect(num,from,to);
162145
return this.requestObject(str,(position,next,tone)=>{
163146
if (str.hasOwnProperty(next) && this.config.creaky.hasOwnProperty(position) && str[next] > 0){
@@ -169,7 +152,7 @@ module.exports = class Notation {
169152
return k.name+k.tone.hasOwnProperty('creaky')?k.name+k.tone.creaky:k.name+k.tone.normal;
170153
}
171154
return k.name+k.tone.normal;
172-
}).join(' ');
155+
}).join(pair);
173156
}
174157
requestDigit(n) {
175158
return n.split('').map(k=>{
@@ -185,9 +168,8 @@ module.exports = class Notation {
185168
if (s)e.push('');
186169
return e.join(this.config.conjunction.plus+this.config.conjunction.space);
187170
}
188-
createString(n) {
189-
// return n.filter(function(e){return e}).join(this.config.conjunction.and+this.config.conjunction.space)
190-
let a= n.filter(function(e){return e});
171+
createString(a) {
172+
// let a= n.filter(function(e){return e});
191173
if (a.length > 1){
192174
return a.slice(0, -1).join(this.config.conjunction.comma)+this.config.conjunction.and+this.config.conjunction.space+a.slice(-1);
193175
} else {

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "myanmar-notation",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"description": "get Myanmar digital and notation",
55
"main": "index.js",
66
"scripts": {
@@ -20,6 +20,9 @@
2020
"engines": {
2121
"node" : ">=6.14.4"
2222
},
23+
"bugs": {
24+
"url": "https://github.com/khensolomon/myanmar-notation/issues"
25+
},
2326
"author": "Khen Solomon Lethil",
2427
"license": "MIT",
2528
"bugs": {

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fs.writeFile("./test.json", JSON.stringify(raw, null, 2), 'utf8', function (err)
1313
if (err) {
1414
return console.log(err);
1515
}
16-
console.log(" ...done");
16+
console.log(" ...done",new notation().config.name);
1717
// let abc = test.requestPrime(1,6,true);
1818
// console.log(abc);
1919
});

test.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
{
2-
"Numeric": "၁,၂၃၄,၅၆၇",
2+
"Numeric": "၁၂၃,ဝဝဝ",
33
"Notation": [
44
{
5-
"sense": "သိန်းပေါင်း တစ်ဆယ့်နှစ်နှင့် သုံးသောင်းလေးထောင်ငါးရာခြောက်ဆယ်နှင့်ခုနစ်"
6-
},
7-
{
8-
"sense": "တစ်သန်းနှစ်သိန်းသုံးသောင်းလေးထောင်ငါးရာခြောက်ဆယ်နှင့်ခုနစ်"
5+
"sense": "တစ်သိန်းနှစ်သောင်းနှင့်သုံးထောင်"
96
}
107
],
11-
"Query": "1234567"
8+
"Query": "123000"
129
}

0 commit comments

Comments
 (0)