Files
introduction-to-testing/examples/characters/src/person.js
2024-09-16 13:13:38 -06:00

18 lines
372 B
JavaScript

import { v4 as id } from 'uuid';
export class Person {
constructor(firstName, lastName) {
if (!firstName || !lastName) {
throw new Error('First name and last name are required');
}
this.id = 'person-' + id();
this.firstName = firstName;
this.lastName = lastName;
}
get fullName() {
return `${this.firstName} ${this.lastName}`;
}
}