-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathentities.js
More file actions
30 lines (28 loc) · 805 Bytes
/
entities.js
File metadata and controls
30 lines (28 loc) · 805 Bytes
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
/* ------------------------------------------------------------------------------
*
*
*
* by Christopher Stelzmüller (tuesd4y)
* 12.02.2017 (tuesd4y) :: created
* 12.02.2017
*
* ---------------------------------------------------------------------------- */
"use strict";
const isNumber = require("util").isNumber;
class TimeTableEntity {
constructor(id, type) {
if(isNumber(id) && id > 0) {
if(isNumber(type) && type > 0 && type <= 5) {
this.type = type;
this.id = id;
} else {
throw Error("type has to be a number between 0 and 6")
}
} else {
throw Error("id has to be a number greater than 0")
}
}
}
module.exports = {
TimeTableEntity: TimeTableEntity
};