npm.io
6.1.0 • Published 1 year ago

is-svg

Licence
MIT
Version
6.1.0
Deps
1
Size
4 kB
Vulns
0
Weekly
0
Stars
142

is-svg

Check if a string is SVG

Install

npm install is-svg

Usage

import isSvg from 'is-svg';

isSvg('<svg xmlns="http://www.w3.org/2000/svg"><path fill="#00CD9F"/></svg>');
//=> true

API

isSvg(string, options?)
options

Type: object

validate

Type: boolean
Default: true

Whether to validate the SVG as proper XML.

Turning this off can improve performance significantly.

Keywords