Nodular Pudding Multiverse
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

is-an-image-url

1.0.3 • Public • Published

is-an-image-url

npm package

Build Status Dependency Status Coverage Status Known Vulnerabilities XO code style Gitter

NPM

Does an async checks to see if a url is an image url.

Minor note: This package was originally created as an async replacement for is-image-url. I was using that one but my snyk security scanner said there was issue with one of the dependencies. I posted a pull request but a new version never got published, so onward and upward. The other lib was synchronous, I figured I'd make an async version.

Installation

Installation is easiest through npm:

npm install is-an-image-url --save

Usage

is-an-image-url can be included as a reference.

var isAnImageUrl = require('is-an-image-url');

isAnImageUrl(url, function(isAnImageResult){
  if(isAnImageResult){
      console.log("yes the url was an image");
  }else {
      console.log("no, the url was not an image");
  }
});

CLI

$ npm install --global is-an-image-url
$ is-an-image-url --help

  Usage
    $ is-an-image-url "<url>"

  Example
    $ is-an-image-url "http://www.google.com"

The isAnImageUrl package will use the callback function with the following signature callback(isAnImageResult). isAnImageResult will be a bool, true if the url is for an image and false otherwise.

License

MIT © Mark Rogers

Keywords

install

npm i is-an-image-url

Downloadsweekly downloads

5

version

1.0.3

license

MIT

repository

githubgithub

last publish

collaborators

  • avatar