main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
551 bytes
|
Rev | Line | |
---|
[d565449] | 1 | /**
|
---|
| 2 | * Defines non-writable/enumerable properties of the provided target object.
|
---|
| 3 | *
|
---|
| 4 | * @param {Object} target - Object for which to define properties.
|
---|
| 5 | * @param {Object} props - Properties to be defined.
|
---|
| 6 | * @returns {Object} Target object.
|
---|
| 7 | */
|
---|
| 8 | export default (target, props) => {
|
---|
| 9 | for (const key of Object.keys(props)) {
|
---|
| 10 | Object.defineProperty(target, key, {
|
---|
| 11 | value: props[key],
|
---|
| 12 | enumerable: false,
|
---|
| 13 | writable: false,
|
---|
| 14 | configurable: true
|
---|
| 15 | });
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | return target;
|
---|
| 19 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.