@nozbe/watermelondb
Version:
Build powerful React Native and React web apps that scale from hundreds to tens of thousands of records and remain fast
14 lines (13 loc) • 534 B
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = ensureSync;
var _invariant = _interopRequireDefault(require("../invariant"));
// Throws if passed value is a Promise
// Otherwise, returns the passed value as-is.
//
// Use to ensure API users aren't passing async functions
function ensureSync(value) {
(0, _invariant.default)(!(value instanceof Promise), 'Unexpected Promise. Passed function should be synchronous.');
return value;
}