1.0.0 • Published 9 years ago

is-dom-image v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

is-dom-image

frozen

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

NPM

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.