Created
January 14, 2017 17:23
-
-
Save AnnaMag/12ee15774ca1f3b093f36ea27047621a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
require('../common'); | |
var assert = require('assert'); | |
var vm = require('vm'); | |
var Parent = Object.create(null); | |
Parent.prototype = { | |
sProp: 'some string value', | |
numProp: 2, | |
bProp: false | |
}; | |
var child = Object.create(Parent.prototype, { | |
color: { writable: true, value: 'red' }, | |
desc: { | |
configurable: true, | |
get: function () { return "get working"; }, | |
set: function (value) { this.color = value; } | |
} | |
}); | |
const context = vm.createContext(child); | |
const code = `Object.getOwnPropertyDescriptor(this, "bProp"); | |
this.desc; | |
`; | |
const codee = ` | |
`; | |
const res = vm.runInContext(code, context); | |
console.log(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment