forked from RonRadtke/react-native-blob-util
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some more fixes for another import cycle
- Loading branch information
Ron Radtke
committed
Aug 29, 2021
1 parent
9fa85bf
commit 602d8eb
Showing
6 changed files
with
45 additions
and
42 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
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
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,28 +1,33 @@ | ||
export default { | ||
|
||
isFileURI : (uri:string):boolean => { | ||
if(typeof uri !== 'string') | ||
return false; | ||
return /^ReactNativeBlobUtil-file\:\/\//.test(uri); | ||
}, | ||
isFileURI: (uri: string): boolean => { | ||
if (typeof uri !== 'string') | ||
return false; | ||
return /^ReactNativeBlobUtil-file\:\/\//.test(uri); | ||
}, | ||
|
||
isJSONStreamURI : (uri:string):boolean => { | ||
if(typeof uri !== 'string') | ||
return false; | ||
return /^JSONStream\:\/\//.test(uri); | ||
}, | ||
isJSONStreamURI: (uri: string): boolean => { | ||
if (typeof uri !== 'string') | ||
return false; | ||
return /^JSONStream\:\/\//.test(uri); | ||
}, | ||
|
||
removeURIScheme : (uri:string, iterations:number):string => { | ||
iterations = iterations || 1; | ||
let result = uri; | ||
for(let i=0; i<iterations; i++) { | ||
result = String(result).replace(/^[^\:]+\:\/\//, ''); | ||
} | ||
return String(result); | ||
}, | ||
removeURIScheme: (uri: string, iterations: number): string => { | ||
iterations = iterations || 1; | ||
let result = uri; | ||
for (let i = 0; i < iterations; i++) { | ||
result = String(result).replace(/^[^\:]+\:\/\//, ''); | ||
} | ||
return String(result); | ||
}, | ||
|
||
unwrapFileURI: (uri: string): string => { | ||
return String(uri).replace(/^ReactNativeBlobUtil-file\:\/\//, ''); | ||
}, | ||
|
||
unwrapFileURI : (uri:string):string => { | ||
return String(uri).replace(/^ReactNativeBlobUtil-file\:\/\//, ''); | ||
} | ||
wrap: (path: string): string => { | ||
const prefix = path.startsWith('content://') ? 'ReactNativeBlobUtil-content://' : 'ReactNativeBlobUtil-file://'; | ||
return prefix + path; | ||
} | ||
|
||
}; |