I am using the above mentioned method in my current project. Now I'm stuck in one requirement where the value of one variable should change according to the some conditions .
example :-
export class Course {
constructor(
public id: number,
public code: string,
public name: string,
public created: Date,
) { }
static adapt(item: any): Course {
return new Course(
item.id,
item.code,
item.name,//Change the name to "john doe" if item.id=0 and item.code = john
new Date(item.created),
);
}
}
Is there any option for me to add a function which would perform this action?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Florimond Manca,
I am using the above mentioned method in my current project. Now I'm stuck in one requirement where the value of one variable should change according to the some conditions .
example :-
export class Course {
constructor(
public id: number,
public code: string,
public name: string,
public created: Date,
) { }
static adapt(item: any): Course {
return new Course(
item.id,
item.code,
item.name,//Change the name to "john doe" if item.id=0 and item.code = john
new Date(item.created),
);
}
}
Is there any option for me to add a function which would perform this action?