react-native-nitro-wallet
Version:
A React Native package for interacting with Apple or Google Wallet
20 lines (19 loc) • 649 B
JavaScript
;
import { Platform } from "react-native";
export const isIOS = Platform.OS === "ios";
export const isAndroid = Platform.OS === "android";
export const PLATFORM_NOT_SUPPORTED_CODE = "PLATFORM_NOT_SUPPORTED";
export function platformNotSupported(methodName, platform) {
const error = new Error(`${methodName} is not supported on ${platform}.`);
error.code = PLATFORM_NOT_SUPPORTED_CODE;
return error;
}
export function iosOnly(fn, methodName) {
return (...args) => {
if (Platform.OS !== "ios") {
throw platformNotSupported(methodName, Platform.OS);
}
return fn(...args);
};
}
//# sourceMappingURL=utils.js.map