/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ /** * A browser friendly assert library. * Use this instead of the 'assert' package, which has a big impact on bundle sizes. * @param condition - The condition that should be true, if the condition is false an error will be thrown. * Only use this API when `false` indicates a logic error in the problem and thus a bug that should be fixed. * @param message - The message to include in the error when the condition does not hold. * A number should not be specified manually: use a string. * Before a release, policy-check should be run, which will convert any asserts still using strings to * use numbered error codes instead. * * @deprecated Moved to the `@fluidframework/core-utils` package. * @internal */ export function assert(condition: boolean, message: string | number): asserts condition { if (!condition) { throw new Error( typeof message === "number" ? `0x${message.toString(16).padStart(3, "0")}` : message, ); } }