@warp-drive/build-config
Version:
Provides Build Configuration for projects using WarpDrive or EmberData
26 lines (22 loc) • 577 B
JavaScript
/**
* Internal functions for instrumenting the library's code with behaviors
* that are removed from production builds.
*
* @hidden
* @module
*/
/**
* A type-narrowing assertion function that throws an error with the supplied
* message if the condition is falsy.
*
* Asserts are removed from production builds, making this a "zero cost abstraction"
* so liberal usage of this function to ensure runtime correctness is encouraged.
*
* @internal
*/
function assert(message, condition) {
if (!condition) {
throw new Error(message);
}
}
export { assert };