UNPKG

@nozbe/watermelondb

Version:

Build powerful React Native and React web apps that scale from hundreds to tens of thousands of records and remain fast

18 lines (13 loc) 382 B
// @flow import invariant from '../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 export default function ensureSync<T>(value: T): T { invariant( !(value instanceof Promise), 'Unexpected Promise. Passed function should be synchronous.', ) return value }