forked from DerivcoIpswich/dsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProperties.js
More file actions
41 lines (35 loc) · 991 Bytes
/
Copy pathProperties.js
File metadata and controls
41 lines (35 loc) · 991 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
34
35
36
37
38
39
40
41
function createReadonlyProperty(instance, propertyName , value) {
Object.defineProperty(instance, propertyName, {
get: function () { return value; }
});
return value;
}
function createPropertyGet(obj, propertyName, fn) {
Object.defineProperty(obj, propertyName, {
configurable: true,
get: fn
});
}
function createPropertySet(obj, propertyName, fn) {
Object.defineProperty(obj, propertyName, {
configurable: true,
set: fn
});
}
function defineProperty(instance, propertyName) {
var prop = undefined;
Object.defineProperty(instance, propertyName, {
get: function () { return prop; },
set: function (value) { prop = value; },
enumerable: true
});
}
function initializeObject(obj, initializerMap) {
if (!isValue(obj) || !isValue(initializerMap)) {
return obj;
}
for (var prop in initializerMap) {
obj[prop] = initializerMap[prop];
}
return obj;
}