@react-native-firebase/common
Advanced tools
Comparing version 6.0.0-alpha.9 to 6.0.0-alpha.10
@@ -18,17 +18,19 @@ /* | ||
import { Platform } from 'react-native'; | ||
import { isString } from './validate'; | ||
import Base64 from './Base64'; | ||
export * from './path'; | ||
export * from './validate'; | ||
export Base64 from './Base64'; | ||
export promiseDefer from './promiseDefer'; | ||
export ReferenceBase from './ReferenceBase'; | ||
export function promiseDefer() { | ||
const deferred = { | ||
resolve: null, | ||
reject: null, | ||
}; | ||
deferred.promise = new Promise((resolve, reject) => { | ||
deferred.resolve = resolve; | ||
deferred.reject = reject; | ||
}); | ||
return deferred; | ||
export function getDataUrlParts(dataUrlString) { | ||
const isBase64 = dataUrlString.includes(`;base64`); | ||
let [mediaType, base64String] = dataUrlString.split(','); | ||
if (!mediaType || !base64String) return { base64String: undefined, mediaType: undefined }; | ||
mediaType = mediaType.replace('data:', '').replace(';base64', ''); | ||
if (base64String && base64String.includes('%')) base64String = decodeURIComponent(base64String); | ||
if (!isBase64) base64String = Base64.btoa(base64String); | ||
return { base64String, mediaType }; | ||
} | ||
@@ -62,4 +64,15 @@ | ||
/** | ||
* Remove a trailing forward slash from a string if it exists | ||
* | ||
* @param string | ||
* @returns {*} | ||
*/ | ||
export function stripTrailingSlash(string) { | ||
if (!isString(string)) return string; | ||
return string.endsWith('/') ? string.slice(0, -1) : string; | ||
} | ||
export const isIOS = Platform.OS === 'ios'; | ||
export const isAndroid = Platform.OS === 'android'; |
{ | ||
"name": "@react-native-firebase/common", | ||
"version": "6.0.0-alpha.9", | ||
"version": "6.0.0-alpha.10", | ||
"author": "Invertase <oss@invertase.io> (http://invertase.io)", | ||
@@ -18,3 +18,3 @@ "description": "React Native Firebase internal common utilities & helpers.", | ||
], | ||
"gitHead": "bfe0f05ab36fdd20df3470a71a9ee8c5a938baf6", | ||
"gitHead": "832835bc23987d794520996b23468870f343ef80", | ||
"publishConfig": { | ||
@@ -21,0 +21,0 @@ "access": "public" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15479
9
399