invariant
Usage
import { invariant } from "@olenbetong/appframe-core";
// before
if (dsMyDataObject.getFields("Name")) {
if (typeof newValue === "string") {
dsMyDataObject.currentRow("Name", newValue);
} else {
throw Error("Name must be a string");
}
} else {
throw Error("Name is not in the data object!");
}
// after
invariant(dsMyDataObject.getFields("Name"), "Name is not in the data object!");
invariant(typeof newValue === "string", "Name must be a string");
dsMyDataObject.currentRow("Name", newValue);API
Last updated
Was this helpful?