Socket
Socket
Sign inDemoInstall

is-svg

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-svg - npm Package Compare versions

Comparing version 4.2.1 to 4.2.2

12

index.js

@@ -24,8 +24,16 @@ 'use strict';

const regex = /^\s*(?:<\?xml[^>]*>\s*)?(?:<!doctype svg[^>]*\s*(?:\[?(?:\s*<![^>]*>\s*)*\]?)*[^>]*>\s*)?(?:<svg[^>]*>[^]*<\/svg>|<svg[^/>]*\/\s*>)\s*$/i;
const removeDtdMarkupDeclarations = svg => svg.replace(/\[?(?:\s*<![A-Z]+[^>]*>\s*)*\]?/g, '');
const isSvg = input => Boolean(input) && !isBinary(input) && regex.test(cleanEntities(input.toString()).replace(htmlCommentRegex, ''));
const clean = svg => {
svg = cleanEntities(svg);
svg = removeDtdMarkupDeclarations(svg);
return svg;
};
const regex = /^\s*(?:<\?xml[^>]*>\s*)?(?:<!doctype svg[^>]*>\s*)?(?:<svg[^>]*>[^]*<\/svg>|<svg[^/>]*\/\s*>)\s*$/i;
const isSvg = input => Boolean(input) && !isBinary(input) && regex.test(clean(input.toString()).replace(htmlCommentRegex, ''));
module.exports = isSvg;
// TODO: Remove this for the next major release
module.exports.default = isSvg;

5

package.json
{
"name": "is-svg",
"version": "4.2.1",
"version": "4.2.2",
"description": "Check if a string or buffer is SVG",

@@ -11,3 +11,3 @@ "license": "MIT",

"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},

@@ -46,2 +46,3 @@ "engines": {

"ava": "^1.4.1",
"time-span": "^4.0.0",
"tsd": "^0.7.2",

@@ -48,0 +49,0 @@ "xo": "^0.24.0"

@@ -1,2 +0,2 @@

# is-svg [![Build Status](https://travis-ci.org/sindresorhus/is-svg.svg?branch=master)](https://travis-ci.org/sindresorhus/is-svg)
# is-svg

@@ -3,0 +3,0 @@ > Check if a string or buffer is [SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc