Package Exports
- get-src
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (get-src) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
get-src

Get the 'src' value from any string containing a src="" (embed, iframe, html, etc).
Install
$ npm install --save get-src
Usage
const getSrc = require('get-src');
getSrc('<image src="image.png" />');
//=> 'image.png'
getSrc('<iframe width="400" height="300" src="video.mp4"></iframe>');
//=> 'video.mp4'
API
getSrc(input)
input
Type: string
The string containing the src=""
from which you want to extract the src value.
Double Quotes Only
Currently, there is only support for double quotes, meaning the value you want to extract must rest inside two double quotes:
Valid
src="this is valid"
Invalid
src='this will return undefined'
Pull requests are welcome if you want to add support for double AND single quotes.
License
MIT © Michael Wuergler