-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobject_base.js
More file actions
33 lines (29 loc) · 1014 Bytes
/
object_base.js
File metadata and controls
33 lines (29 loc) · 1014 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
31
32
33
/**
* This is the base object class. It contains functions that should be a part
* of almost all objects defined in this project.
*/
export class Object_Base {
/**
* Test options passed in against a list of required options.
* @param {Object} options - An object of options
* @param {Array} required - An array of options that are required.
*/
_required_options( options, required ) {
for( let i in required ) {
let key = required[ i ];
let value = options[ key ];
if( typeof( value ) == 'undefined' ) {
throw new Error( "Grid: missing required argument: " + key );
}
}
}
/**
* assign all the options to the object so they can be used else where in the object.
* @param {Object} options - An object of options to be assigned to this object.
*/
_setup_object( options ) {
for( let key in options ) {
this[ key ] = options[ key ];
}
}
}