Use constructor name to check if Promise

This commit is contained in:
Ryohei Ikegami 2015-08-01 12:20:16 +09:00
parent 428ad20807
commit c8a794ac34
2 changed files with 2 additions and 2 deletions

View file

@ -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?