Lines of Code | 17 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 60% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | /** |
||
11 | class ParserInterface { |
||
12 | /** |
||
13 | * ParserInterface constructor |
||
14 | * @throws TypeError When create new instance |
||
15 | * @throws Error When parse method does not define |
||
16 | */ |
||
17 | constructor () { |
||
18 | 12 | if (new.target === ParserInterface) { |
|
19 | throw new TypeError('ParserInterface is interface') |
||
20 | } |
||
21 | 12 | if (typeof this.parse === 'undefined' || typeof this.parse !== 'function') { |
|
22 | throw new Error('Parse method must be defined') |
||
23 | } |
||
24 | } |
||
25 | } |
||
26 | |||
27 | module.exports = ParserInterface |