Comparing version 4.2.0 to 4.2.1
@@ -18,5 +18,11 @@ 'use strict'; | ||
const cleanEntities = svg => { | ||
const entityRegex = /\s*<!Entity\s+\S*\s*(?:"|')[^"]+(?:"|')\s*>/img; | ||
// Remove entities | ||
return svg.replace(entityRegex, ''); | ||
}; | ||
const regex = /^\s*(?:<\?xml[^>]*>\s*)?(?:<!doctype svg[^>]*\s*(?:\[?(?:\s*<![^>]*>\s*)*\]?)*[^>]*>\s*)?(?:<svg[^>]*>[^]*<\/svg>|<svg[^/>]*\/\s*>)\s*$/i; | ||
const isSvg = input => Boolean(input) && !isBinary(input) && regex.test(input.toString().replace(htmlCommentRegex, '')); | ||
const isSvg = input => Boolean(input) && !isBinary(input) && regex.test(cleanEntities(input.toString()).replace(htmlCommentRegex, '')); | ||
@@ -23,0 +29,0 @@ module.exports = isSvg; |
{ | ||
"name": "is-svg", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "Check if a string or buffer is SVG", | ||
"license": "MIT", | ||
"repository": "sindresorhus/is-svg", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
@@ -8,0 +9,0 @@ "name": "Sindre Sorhus", |
@@ -5,3 +5,2 @@ # is-svg [![Build Status](https://travis-ci.org/sindresorhus/is-svg.svg?branch=master)](https://travis-ci.org/sindresorhus/is-svg) | ||
## Install | ||
@@ -13,3 +12,2 @@ | ||
## Usage | ||
@@ -24,3 +22,2 @@ | ||
## Edge cases | ||
@@ -34,5 +31,12 @@ | ||
--- | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-is-svg?utm_source=npm-is-svg&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> |
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
4609
42
39