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; |
{ | ||
"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) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4679
48
5