Reduction for Object.defineProperty method for define properties
import { define } from '@biorate/tools';
const obj = {};
define.prop(obj, 'test1', 1, 'cwe')
('test2', 2, 'c')
('test3', 3, '');
console.log(obj); // { test1: 1 }
console.log(Object.getOwnPropertyDescriptor(obj, 'test1')); // { value: 1, writable: true, enumerable: true, configurable: true }
console.log(Object.getOwnPropertyDescriptor(obj, 'test2')); // { value: 2, writable: false, enumerable: false, configurable: true }
console.log(Object.getOwnPropertyDescriptor(obj, 'test3')); // { value: 3, writable: false, enumerable: false, configurable: false }
Generated using TypeDoc
Object to define property