You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We introduced some duck typing for IAppliance, Payload, and PayloadArray.
The issue is that if you try to duck type a null or undefined value, it breaks with the following error:
/Users/slifty/Dropbox/Code/NodeJS/tvkitchen/base/packages/interfaces/lib/IAppliance.js:86
_defineProperty(IAppliance, "isIAppliance", obj => IAppliance.duckTypeProperties.every(property => Object.prototype.hasOwnProperty.call(obj, property)));
^
TypeError: Cannot convert undefined or null to object
at hasOwnProperty (<anonymous>)
at /Users/slifty/Dropbox/Code/NodeJS/tvkitchen/base/packages/interfaces/lib/IAppliance.js:86:132
at Array.every (<anonymous>)
at Function.isIAppliance (/Users/slifty/Dropbox/Code/NodeJS/tvkitchen/base/packages/interfaces/lib/IAppliance.js:86:82)
at Object.<anonymous> (/Users/slifty/Dropbox/Code/NodeJS/tvkitchen/countertop/src/scripts/_sandbox.js:15:12)
at Module._compile (internal/modules/cjs/loader.js:1147:30)
at Module._compile (/Users/slifty/Dropbox/Code/NodeJS/tvkitchen/countertop/node_modules/pirates/lib/index.js:99:24)
at Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Object.newLoader [as .js] (/Users/slifty/Dropbox/Code/NodeJS/tvkitchen/countertop/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:996:32)
Input
Code, command line, or other relevant input / steps to reproduce the issue.
Bug
Current Behavior
We introduced some duck typing for
IAppliance
,Payload
, andPayloadArray
.The issue is that if you try to duck type a null or undefined value, it breaks with the following error:
Input
Code, command line, or other relevant input / steps to reproduce the issue.
Expected Behavior
It should return
true
orfalse
as documented, sincenull
andundefined
values are either IAppliances or they are not.undefined
should evoke afalse
value.null
should probably evoke afalse
value, though it is a bit of an existential question: Is null an instance of everything, or an instance of nothing?Possible Solutions
We should update duck type instances to detect null and undefined and return a proper value.
Related Issues
A list of related issues
The text was updated successfully, but these errors were encountered: