react-native-modalfy
Version:
Modal citizen of React Native
32 lines (26 loc) • 1.09 kB
JavaScript
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
// s/o https://www.npmjs.com/package/ts-invariant
/* eslint-disable no-proto */
const genericMessage = 'Invariant Violation';
const {
setPrototypeOf = function (obj, proto) {
obj.__proto__ = proto;
return obj;
}
} = Object;
export class InvariantError extends Error {
constructor() {
let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : genericMessage;
super(typeof message === 'number' ? `${genericMessage}: ${message} (see https://github.com/apollographql/invariant-packages)` : message);
_defineProperty(this, "framesToPop", 1);
_defineProperty(this, "name", genericMessage);
setPrototypeOf(this, InvariantError.prototype);
}
}
export function invariant(condition, message) {
if (!condition) {
throw new InvariantError(message);
}
}
export default invariant;
//# sourceMappingURL=invariant.js.map