if-is-image
Check if a string, filepath, or url references an image file.
Installation
npm
With npm install
yarn
With yarn add
Usage
In a node project
Import the script to your project
;// orconst ifIsImage = ;
And execute the script:
const isImage = ; // falseconst isImage = ; // trueconst isImage = ; // trueconst isImage = ; // throw: Path to image must be a string
Contributing
Fork the repo and clone locally, then run:
yarn install
This will install the devDependencies
packages and build the lib
folder.
Once you've made your desired changes, make sure to write any new tests for your feature and run the tests:
yarn run lint # lints js yarn test # runs test suite
If all tests pass, create a pull request.