-
-
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
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,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