detect-svg

0.9.1 • Public • Published

detect-svg

Detect a string or buffer is SVG or not. (javascript, nodejs)

Installing

npm i detect-svg

You can view this package at npm (https://www.npmjs.com/package/detect-svg)

Example

detectSVG('<svg xmlns="http://www.w3.org/2000/svg"><path fill="#00CD9F"/></svg>')
// true
detectSVG('<svg></svg>')
// true
detectSVG('<svg>')
// false
detectSVG('<html></html>')
// false
detectSVG('')
// false
detectSVG(undefined)
// false

Using detect-svg

const detectSVG = require("detect-svg");
 
console.log( detectSVG('<svg xmlns="http://www.w3.org/2000/svg"><path fill="#00CD9F"/></svg>') )

Max Base

My nickname is Max, Programming language developer, Full-stack programmer. I love computer scientists, researchers, and compilers. (Max Base)

Asrez Team

A team includes some programmer, developer, designer, researcher(s) especially Max Base.

Asrez Team

Package Sidebar

Install

npm i detect-svg

Weekly Downloads

48

Version

0.9.1

License

MIT

Unpacked Size

3.63 kB

Total Files

4

Last publish

Collaborators

  • basemax