Galerie und tage
This commit is contained in:
26
node_modules/is-svg/index.d.ts
generated
vendored
26
node_modules/is-svg/index.d.ts
generated
vendored
@@ -1,26 +0,0 @@
|
||||
/// <reference types="node"/>
|
||||
|
||||
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;
|
||||
47
node_modules/is-svg/index.js
generated
vendored
47
node_modules/is-svg/index.js
generated
vendored
@@ -1,40 +1,19 @@
|
||||
'use strict';
|
||||
const parser = require('fast-xml-parser');
|
||||
|
||||
const isSvg = input => {
|
||||
if (input === undefined || input === null) {
|
||||
return false;
|
||||
function isBinary(buf) {
|
||||
var isBuf = Buffer.isBuffer(buf);
|
||||
|
||||
for (var i = 0; i < 24; i++) {
|
||||
var charCode = isBuf ? buf[i] : buf.charCodeAt(i);
|
||||
|
||||
if (charCode === 65533 || charCode <= 8) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
input = input.toString().trim();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (input.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Has to be `!==` as it can also return an object with error info.
|
||||
if (parser.validate(input) !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let jsonObject;
|
||||
try {
|
||||
jsonObject = parser.parse(input);
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!jsonObject) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!('svg' in jsonObject)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
module.exports = function (buf) {
|
||||
return !isBinary(buf) && /<svg[^>]*>[^]*<\/svg>\s*$/.test(buf);
|
||||
};
|
||||
|
||||
module.exports = isSvg;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = isSvg;
|
||||
|
||||
20
node_modules/is-svg/license
generated
vendored
20
node_modules/is-svg/license
generated
vendored
@@ -1,9 +1,21 @@
|
||||
MIT License
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
85
node_modules/is-svg/package.json
generated
vendored
85
node_modules/is-svg/package.json
generated
vendored
@@ -1,49 +1,40 @@
|
||||
{
|
||||
"name": "is-svg",
|
||||
"version": "4.3.1",
|
||||
"description": "Check if a string or buffer is SVG",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-svg",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"svg",
|
||||
"vector",
|
||||
"graphics",
|
||||
"image",
|
||||
"img",
|
||||
"pic",
|
||||
"picture",
|
||||
"type",
|
||||
"detect",
|
||||
"check",
|
||||
"is",
|
||||
"string",
|
||||
"str",
|
||||
"buffer"
|
||||
],
|
||||
"dependencies": {
|
||||
"fast-xml-parser": "^3.19.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^11.13.0",
|
||||
"ava": "^1.4.1",
|
||||
"time-span": "^4.0.0",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
"name": "is-svg",
|
||||
"version": "1.1.1",
|
||||
"description": "Check if a String/Buffer is SVG",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-svg",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"svg",
|
||||
"vector",
|
||||
"graphics",
|
||||
"image",
|
||||
"img",
|
||||
"pic",
|
||||
"picture",
|
||||
"type",
|
||||
"detect",
|
||||
"check",
|
||||
"is",
|
||||
"string",
|
||||
"str",
|
||||
"buffer"
|
||||
],
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
}
|
||||
}
|
||||
|
||||
25
node_modules/is-svg/readme.md
generated
vendored
25
node_modules/is-svg/readme.md
generated
vendored
@@ -1,30 +1,23 @@
|
||||
# is-svg
|
||||
# is-svg [](https://travis-ci.org/sindresorhus/is-svg)
|
||||
|
||||
> Check if a String/Buffer is [SVG](http://en.wikipedia.org/wiki/Scalable_Vector_Graphics)
|
||||
|
||||
> Check if a string or buffer is [SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics)
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save is-svg
|
||||
```
|
||||
$ npm install is-svg
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const isSvg = require('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>
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
|
||||
Reference in New Issue
Block a user