react-native-nitro-wallet
Version:
A React Native package for interacting with Apple or Google Wallet
27 lines (26 loc) • 978 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PLATFORM_NOT_SUPPORTED_CODE = void 0;
exports.iosOnly = iosOnly;
exports.isIOS = exports.isAndroid = void 0;
exports.platformNotSupported = platformNotSupported;
var _reactNative = require("react-native");
const isIOS = exports.isIOS = _reactNative.Platform.OS === "ios";
const isAndroid = exports.isAndroid = _reactNative.Platform.OS === "android";
const PLATFORM_NOT_SUPPORTED_CODE = exports.PLATFORM_NOT_SUPPORTED_CODE = "PLATFORM_NOT_SUPPORTED";
function platformNotSupported(methodName, platform) {
const error = new Error(`${methodName} is not supported on ${platform}.`);
error.code = PLATFORM_NOT_SUPPORTED_CODE;
return error;
}
function iosOnly(fn, methodName) {
return (...args) => {
if (_reactNative.Platform.OS !== "ios") {
throw platformNotSupported(methodName, _reactNative.Platform.OS);
}
return fn(...args);
};
}
//# sourceMappingURL=utils.js.map