-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35aeafd
commit d29071c
Showing
7 changed files
with
49 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,12 @@ | ||
declare const isSvg: { | ||
/** | ||
Check if a string or buffer is [SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics). | ||
@param input - The data to check. | ||
@returns Whether `input` is SVG or not. | ||
@example | ||
``` | ||
import isSvg = require('is-svg'); | ||
isSvg('<svg xmlns="http://www.w3.org/2000/svg"><path fill="#00CD9F"/></svg>'); | ||
//=> true | ||
``` | ||
*/ | ||
(input: string | Buffer): boolean; | ||
|
||
// TODO: Remove this for the next major release, refactor the whole definition to: | ||
// declare function isSvg(input: string | Buffer): boolean; | ||
// export = isSvg; | ||
default: typeof isSvg; | ||
}; | ||
|
||
export = isSvg; | ||
/** | ||
Check if a string is [SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics). | ||
@example | ||
``` | ||
import isSvg from 'is-svg'; | ||
isSvg('<svg xmlns="http://www.w3.org/2000/svg"><path fill="#00CD9F"/></svg>'); | ||
//=> true | ||
``` | ||
*/ | ||
export default function isSvg(string: string): boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
import {expectType} from 'tsd'; | ||
import isSvg = require('.'); | ||
import isSvg from './index.js'; | ||
|
||
const data = '<svg></svg>'; | ||
|
||
expectType<boolean>(isSvg(data)); | ||
expectType<boolean>(isSvg(Buffer.from(data))); | ||
expectType<boolean>(isSvg('<svg></svg>')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
MIT License | ||
|
||
Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com) | ||
Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "is-svg", | ||
"version": "4.4.0", | ||
"description": "Check if a string or buffer is SVG", | ||
"description": "Check if a string is SVG", | ||
"license": "MIT", | ||
"repository": "sindresorhus/is-svg", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
|
@@ -10,8 +10,13 @@ | |
"email": "[email protected]", | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"engines": { | ||
"node": ">=6" | ||
"node": ">=14.16" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd" | ||
|
@@ -25,25 +30,21 @@ | |
"vector", | ||
"graphics", | ||
"image", | ||
"img", | ||
"pic", | ||
"picture", | ||
"type", | ||
"detect", | ||
"check", | ||
"is", | ||
"string", | ||
"str", | ||
"buffer" | ||
"string" | ||
], | ||
"dependencies": { | ||
"fast-xml-parser": "^4.1.3" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^11.13.0", | ||
"ava": "^1.4.1", | ||
"time-span": "^4.0.0", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
"@types/node": "^18.14.2", | ||
"ava": "^5.2.0", | ||
"time-span": "^5.1.0", | ||
"tsd": "^0.25.0", | ||
"xo": "^0.53.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,18 @@ | ||
# is-svg | ||
|
||
> Check if a string or buffer is [SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics) | ||
> Check if a string is [SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics) | ||
## Install | ||
|
||
``` | ||
$ npm install is-svg | ||
```sh | ||
npm install is-svg | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
const isSvg = require('is-svg'); | ||
import isSvg from 'is-svg'; | ||
|
||
isSvg('<svg xmlns="http://www.w3.org/2000/svg"><path fill="#00CD9F"/></svg>'); | ||
//=> true | ||
``` | ||
|
||
--- | ||
|
||
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters