Skip to content

Commit ae72197

Browse files
docs(MessageFunctionBuilder): update.
1 parent 17ce5e0 commit ae72197

1 file changed

Lines changed: 26 additions & 18 deletions

File tree

src/message-builder/src/message-function-builder.class.ts

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { MessageBuilder } from './message-builder.class';
44
// Interface.
55
import { Parameter } from '../interface/parameter.interface';
66
/**
7-
*
7+
* Message function builder for error message of a string type.
8+
* @version Experimental This `object` is an experimental version of the message function builder that is using `MessageBuilder`.
89
*/
910
export class MessageFunctionBuilder {
1011
#messageBuilder: MessageBuilder;
@@ -15,16 +16,22 @@ export class MessageFunctionBuilder {
1516
};
1617
#return = '';
1718

19+
/**
20+
* Gets the build function of a `string` type.
21+
*/
1822
get get(): string {
1923
return this.#messageBuilder.get;
2024
}
2125

26+
/**
27+
* Creates an instance of `MessageFunctionBuilder`.
28+
*/
2229
constructor() {
2330
this.#messageBuilder = new MessageBuilder('function');
2431
}
2532

2633
/**
27-
* Build function message.
34+
* Builds string-type function from the privately stored `name`, `param`, and `return`.
2835
*/
2936
public build(): this {
3037
this
@@ -36,24 +43,26 @@ export class MessageFunctionBuilder {
3643
}
3744

3845
/**
39-
* Sets the function name to build message.
46+
* Sets the function name to build function of a `string` type.
4047
* @param name Function name of a `string` type.
41-
* @param callback
42-
* @returns The return value is an instance of `MessageBuilderFunction`.
48+
* @param callback An optional callback function of `ResultCallback` to handle the result of the check whether the provided `name`
49+
* is a `string` type.
50+
* @returns The return value is an instance of `MessageFunctionBuilder`.
4351
*/
4452
public setName(name: string, callback?: ResultCallback): this {
4553
if (guard.string(name, callback)) {
4654
this.#name = name;
4755
}
48-
// this.setFunction(name);
4956
return this;
5057
}
5158

5259
/**
53-
* Set method param name with type to build message.
54-
* @param name Method param name.
55-
* @param type Method param type.
56-
* @returns this.
60+
* Sets param name with an optional type of `function` to build function of a `string` type.
61+
* @param name Parameter name of a function guarded by string.
62+
* @param type An optional parameter type of function guarded by string.
63+
* @param callback An optional callback function of `ResultCallback` to handle the result of the check whether the provided `name`
64+
* is a `string` type.
65+
* @returns The return value is an instance of `MessageFunctionBuilder`.
5766
*/
5867
public setParam(name: string, type?: string, callback?: ResultCallback): this {
5968
if (guard.string(name, callback)) {
@@ -65,18 +74,17 @@ export class MessageFunctionBuilder {
6574
return this;
6675
}
6776

77+
/**
78+
* Sets return type to build the function of a `string` type.
79+
* @param returns A return type of `function` guarded by `string`.
80+
* @param callback An optional callback function of `ResultCallback` to handle the result of the check whether the provided `returns`
81+
* is a `string` type.
82+
* @returns The return value is an instance of `MessageFunctionBuilder`.
83+
*/
6884
public setReturn(returns: string, callback?: ResultCallback): this {
6985
if (guard.string(returns, callback)) {
7086
this.#return = returns;
7187
}
7288
return this;
7389
}
7490
}
75-
76-
const messageBuilderFunction = new MessageFunctionBuilder();
77-
messageBuilderFunction
78-
.setName('isString')
79-
.setParam('one', 'string')
80-
.setReturn('this')
81-
.build();
82-
console.log(messageBuilderFunction.get);

0 commit comments

Comments
 (0)