Use constructor name to check if Promise
This commit is contained in:
parent
428ad20807
commit
c8a794ac34
2 changed files with 2 additions and 2 deletions
|
@ -10,7 +10,7 @@ valueToMeta = (sender, value) ->
|
|||
meta.type = 'buffer' if Buffer.isBuffer value
|
||||
meta.type = 'value' if value is null
|
||||
meta.type = 'array' if Array.isArray value
|
||||
meta.type = 'promise' if Promise.resolve(value) == value
|
||||
meta.type = 'promise' if value? and value.constructor.name is 'Promise'
|
||||
|
||||
# Treat the arguments object as array.
|
||||
meta.type = 'array' if meta.type is 'object' and value.callee? and value.length?
|
||||
|
|
|
@ -20,7 +20,7 @@ wrapArgs = (args, visited=[]) ->
|
|||
type: 'array', value: wrapArgs(value, visited)
|
||||
else if Buffer.isBuffer value
|
||||
type: 'buffer', value: Array::slice.call(value, 0)
|
||||
else if Promise.resolve(value) == value
|
||||
else if value? and value.constructor.name is 'Promise'
|
||||
type: 'promise', then: valueToMeta(value.then.bind(value))
|
||||
else if value? and typeof value is 'object' and v8Util.getHiddenValue value, 'atomId'
|
||||
type: 'remote-object', id: v8Util.getHiddenValue value, 'atomId'
|
||||
|
|
Loading…
Reference in a new issue