Pass through empty constructor names
This commit is contained in:
parent
a1209b69b3
commit
d67dfd09fd
3 changed files with 5 additions and 4 deletions
|
@ -60,7 +60,7 @@ var wrapArgs = function (args, visited) {
|
||||||
|
|
||||||
ret = {
|
ret = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
name: (value.constructor && value.constructor.name) ? value.constructor.name : 'Object',
|
name: value.constructor != null ? value.constructor.name : 'Object',
|
||||||
members: []
|
members: []
|
||||||
}
|
}
|
||||||
for (prop in value) {
|
for (prop in value) {
|
||||||
|
|
|
@ -34,7 +34,8 @@ describe('ipc module', function () {
|
||||||
assert.equal(a.foo.bar, 'baz')
|
assert.equal(a.foo.bar, 'baz')
|
||||||
assert.equal(a.foo.baz, false)
|
assert.equal(a.foo.baz, false)
|
||||||
assert.equal(a.bar, 1234)
|
assert.equal(a.bar, 1234)
|
||||||
assert.equal(a.baz(Object.create(null)), 'hello')
|
assert.equal(a.getConstructorName(Object.create(null)), 'Object')
|
||||||
|
assert.equal(a.getConstructorName(new (class {})), '')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should search module from the user app', function () {
|
it('should search module from the user app', function () {
|
||||||
|
|
4
spec/fixtures/module/no-prototype.js
vendored
4
spec/fixtures/module/no-prototype.js
vendored
|
@ -4,7 +4,7 @@ foo.baz = false
|
||||||
module.exports = {
|
module.exports = {
|
||||||
foo: foo,
|
foo: foo,
|
||||||
bar: 1234,
|
bar: 1234,
|
||||||
baz: function () {
|
getConstructorName: function (value) {
|
||||||
return 'hello'
|
return value.constructor.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue