Skip to content

Experience-Monks/is-dom-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

test whether an object is a DOM image or canvas

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published