Get image src attributes/urls from HTML.
Crafted with <3 by John Otander (@4lpine).
Installation
npm install --save get-img-src
Usage
var getImgSrc = require('get-img-src')
getImgSrc('<img src="some-img.png"></img> <img src="some-other-img.jpg"></img>', function(err, imgSrcs) {
console.log(imgSrcs)
}) // => ['some-img.png', 'some-other-img.jpg']
getImgSrc('<span>HTML without an image</span>', function(err, imgSrcs) {
console.log(imgSrcs)
}) // => []
License
MITAcknowledgements
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Crafted with <3 by John Otander (@4lpine).
This package was initially generated with yeoman and the p generator.