File: example.js

package info (click to toggle)
node-define-property 2.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 196 kB
  • sloc: makefile: 14; sh: 5
file content (12 lines) | stat: -rw-r--r-- 188 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
var define = require('./');
var obj = {};
var tmp;

define(obj, 'foo', {
  set: (val) => tmp = val,
  get: () => tmp || obj.bar
});

obj.foo = 'one';
obj.bar = 'baz';
console.log(obj.foo)