src/ParserInterface.js   A
last analyzed

Size

Lines of Code 17

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 60%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
nc 1
dl 0
loc 17
ccs 3
cts 5
cp 0.6
rs 10
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A ParserInterface.js ➔ ??? 0 8 4
1
/**
2
 * @ignore module.exports
3
 * @ignore exports
4
 */
5
6
/**
7
 * @interface ParserInterface
8
 * Parser interface
9
 * Declare parse method must be defined in class
10
 */
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