mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
isDataURI method added
This commit is contained in:
@ -62,4 +62,14 @@ export function isFileOrResourcePath(path: string): boolean {
|
||||
return path.indexOf("~/") === 0 || // relative to AppRoot
|
||||
path.indexOf("/") === 0 || // absolute path
|
||||
path.indexOf(RESOURCE_PREFIX) === 0; // resource
|
||||
}
|
||||
|
||||
export function isDataURI(uri: string): boolean {
|
||||
if (!types.isString(uri)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var firstSegment = uri.trim().split(',')[0];
|
||||
|
||||
return firstSegment && firstSegment.indexOf("data:") === 0 && firstSegment.indexOf('base64') >= 0;
|
||||
}
|
Reference in New Issue
Block a user