force-canvas-context
sanity check to get the context if input happens to be the canvas; errors if it can't return a context
Installation
Download node at nodejs.org and install it, if you haven't already.
npm install force-canvas-context --save
Usage
var forceCanvasContext = ; let canvas = document let context = context = context = // Error
API
forceCanvasContext(ctx:context):context
...
License
MIT