@aappddeevv/dynamics-client-ui
Version:
## What is it? A library to help you create great dynamics applications.
34 lines • 971 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Common interfaces for data processing operations.
*/
const monet_1 = require("monet");
/** Makes a status and automatically sets the timestamp to now. */
function mkStatus(inProgress, name, message) {
return {
inProgress,
name,
message: message ? message : undefined,
timestamp: new Date(),
};
}
exports.mkStatus = mkStatus;
/**
* Smart constructors for Result<T, ErrorInfo> instances. If you don't
* use `E=ErrorInfo` you will need to create your own if you want.
*/
exports.ResultOps = {
ok: (c) => monet_1.Either.Right(c),
error: (e) => monet_1.Either.Left(e),
errorNow: (error, message) => monet_1.Either.Left({
error,
message,
timestamp: new Date(),
}),
okNow: (items = []) => monet_1.Either.Right({
items,
timestamp: new Date(),
})
};
//# sourceMappingURL=interfaces.js.map