📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

get-src

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-src

Get the 'src' value from any string containing a src="" (embed, iframe, html, etc).

1.0.1
latest
Source
npm
Version published
Maintainers
1
Created
Source

get-src Build Status Coverage Status

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

Keywords

html

FAQs

Package last updated on 24 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts