Merge pull request #25971 from jeremejevs/is-svg

is-svg: 3.0
This commit is contained in:
Benjamin Lichtman
2018-05-31 21:00:19 -07:00
committed by GitHub
2 changed files with 18 additions and 5 deletions
+8 -3
View File
@@ -1,8 +1,13 @@
// Type definitions for is-svg 2.1
// Type definitions for is-svg 3.0
// Project: https://github.com/sindresorhus/is-svg#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = isSvg;
/// <reference types="node" />
declare function isSvg(input: string): boolean;
declare function isSvg(input?: string | Buffer | false | null): boolean;
// So that `import * as X` is possible
declare namespace isSvg {}
export = isSvg;
+10 -2
View File
@@ -1,3 +1,11 @@
import isSvg = require('is-svg');
import * as isSvg from 'is-svg';
const result: boolean = isSvg('<svg xmlns="http://www.w3.org/2000/svg"><path fill="#00CD9F"/></svg>');
const data = '<svg></svg>';
let result = false;
result = isSvg(data);
result = isSvg(Buffer.from(data));
result = isSvg(false);
result = isSvg(null);
result = isSvg(undefined);
result = isSvg();