src/factory/answer-factory.ts
Methods |
|
Public create | ||||||||
create(answer: Answer | AnswerType)
|
||||||||
Defined in src/factory/answer-factory.ts:7
|
||||||||
Parameters :
Returns :
Answer<>
|
import { isNullOrUndefined } from 'util';
import { Answer } from '../question';
export class AnswerFactory {
public static create<AnswerType>(answer: Answer<AnswerType> | AnswerType): Answer<AnswerType> {
return !isNullOrUndefined(answer) && 'object' === typeof answer
? new Answer<AnswerType>(answer['value'], answer['id'])
: new Answer<AnswerType>(answer);
}
}