import { uuid } from 'uuidv4' ; export class UniqueEntityID { private value : string ; constructor ( id ? ) { this . value = id || uuid ( ) ; } equals ( id ? ) { if ( id === null || id === undefined ) { return false ; } if ( ! ( id instanceof UniqueEntityID ) ) { return false ; } return id . toValue ( ) === this . value ; } toString ( ) { return String ( this . value ) ; } toValue ( ) { return this . value ; } }