position-strings
Version:
Lexicographically-ordered position strings for collaborative lists and text
26 lines • 800 B
JavaScript
export function precond(statement, message, ...optionalParams) {
if (!statement) {
if (optionalParams.length === 0) {
throw new Error(message);
}
else {
throw new Error(message + " " + optionalParams.map((value) => String(value)).join(" "));
}
}
}
export function assert(statement, message, ...optionalParams) {
if (!statement) {
if (message === undefined) {
precond(statement, "Assertion failed", ...optionalParams);
}
else {
precond(statement, "Assertion failed: " + message, ...optionalParams);
}
}
}
/**
* [[PositionSource.LAST]] copy that avoids circular dependencies
* (PositionSource <-> IDs).
*/
export const LastInternal = "~";
//# sourceMappingURL=util.js.map