is-dom-image
v1.0.0
Published
test whether an object is a DOM image or canvas
Downloads
14
Maintainers
Readme
is-dom-image
Returns true if the element is a DOM image, video, canvas, or ImageData
.
These are the same image types supported by the WebGL 1.0 Spec.
Runs in Node and the Browser.
Example
var isDOMImage = require('is-dom-image')
if (isDOMImage(data)) {
// got an image
console.log(data.width, data.height)
}
Install
npm install is-dom-image --save
Usage
isDOMImage(element)
Returns true if element
is an instance of HTMLImageElement, HTMLVideoElement, HTMLCanvasElement or ImageData. Otherwise returns false.
License
MIT, see LICENSE.md for details.