This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/is-svg
2020-11-01 22:46:04 +00:00
..
index.js Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
license Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
package.json Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
readme.md Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00

is-svg Build Status

Check if a string or buffer is SVG

Install

$ npm install is-svg

Usage

const isSvg = require('is-svg');

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

Edge cases

This module performs a quick-and-dirty check. Its fast, but in certain cases it will give incorrect results.

  • Returns true for an SVG-like string that isnt well-formed or valid: <svg><div></svg>

If you want to make certain that your SVG is valid, try parsing it with libxmljs.

License

MIT © Sindre Sorhus