UNPKG

rich-domain

Version:

This package provide utils file and interfaces to assistant build a complex application with domain driving design

26 lines 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Ok = Ok; const result_1 = require("./result"); /** * @description Creates a `Result` instance representing a success state. * * The `Ok` function returns a result indicating that an operation has succeeded. * Optionally, it can include a payload (`data`) representing the successful result * and additional metadata (`metaData`) providing context or supplementary information. * * @typeParam P - The payload type. Defaults to `void` if not provided. * @typeParam E - The error type. Defaults to `string`. * @typeParam M - The metadata type. Defaults to an empty object `{}`. * * @param data An optional payload that represents the successful operation's result. * If no data is provided, defaults to `null` if `P` is `void`. * @param metaData Optional metadata providing additional context about the success. * * @returns A `Result` instance in a success state with the given payload and metadata. */ function Ok(data, metaData) { return result_1.default.Ok(data, metaData); } exports.default = Ok; //# sourceMappingURL=ok.js.map