1 | const Converter = require('./Converter'); |
||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||
2 | const GeezParser = require('../Helper/GeezParser'); |
||
0 ignored issues
–
show
|
|||
3 | const GeezCalculator = require('../Helper/GeezCalculator'); |
||
0 ignored issues
–
show
|
|||
4 | |||
5 | /** |
||
6 | * AsciiConverter converts geez number like <b>፲፱፻፹፮</b> |
||
7 | * to equivalent ascii number like <b>1986</b>. |
||
8 | * |
||
9 | * @author Sam As End <4sam21{at}gmail.com> |
||
10 | */ |
||
11 | module.exports = class AsciiConverter extends Converter { |
||
12 | /** |
||
13 | * Accepts geez number and return an integer. |
||
14 | * |
||
15 | * @param $geez_number string to be converted |
||
16 | * |
||
17 | * @throws NotGeezArgumentException if the valid geez number |
||
18 | * |
||
19 | * @return int the ascii representation |
||
20 | */ |
||
21 | convert($geez_number) { |
||
22 | const $parsed = this.parse($geez_number); |
||
23 | |||
24 | return this.calculate($parsed); |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * Parse the geez number number to a queue. |
||
29 | * |
||
30 | * @param $geez_number |
||
31 | * |
||
32 | * @return Queue |
||
33 | */ |
||
34 | parse($geez_number) { |
||
35 | const $parser = new GeezParser($geez_number); |
||
0 ignored issues
–
show
The variable
GeezParser seems to be never declared. If this is a global, consider adding a /** global: GeezParser */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN. ![]() |
|||
36 | $parser.parse(); |
||
37 | |||
38 | return $parser.getParsed(); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Calculate the ascii from the parsed queue. |
||
43 | * |
||
44 | * @param Queue $parsed |
||
45 | * |
||
46 | * @return int |
||
47 | */ |
||
48 | calculate($parsed) { |
||
49 | const $calculator = new GeezCalculator($parsed); |
||
0 ignored issues
–
show
The variable
GeezCalculator seems to be never declared. If this is a global, consider adding a /** global: GeezCalculator */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN. ![]() |
|||
50 | $calculator.calculate(); |
||
51 | |||
52 | return $calculator.getCalculated(); |
||
53 | } |
||
54 | }; |
||
55 |