11import { ValueObject } from '../core' ;
22import { Result } from '../core' ;
3- import isValidCpfDigit , {
4- formatValueToCpfPattern ,
5- removeSpecialCharsFromCpf ,
6- } from './check-cpf-digit.util' ;
3+ import isValidCpfDigit from './check-cpf-digit.util' ;
4+ import { formatValueToCpfPattern } from './check-cpf-digit.util' ;
75const regexCpf =
86 / ^ ( [ 0 - 9 ] { 3 } ) [ \. ] ( (? ! \1) [ 0 - 9 ] { 3 } ) [ \. ] ( [ 0 - 9 ] { 3 } ) [ - ] ( [ 0 - 9 ] { 2 } ) $ | ^ [ 0 - 9 ] { 11 } $ / ;
97
@@ -36,11 +34,9 @@ export class CPFValueObject extends ValueObject<Prop> {
3634 * @example after "52734865211"
3735 */
3836 removeSpecialChars ( ) : CPFValueObject {
39- this . props . value = removeSpecialCharsFromCpf ( this . props . value ) ;
40-
41- // this.props.value = this.util
42- // .string(this.props.value)
43- // .removeSpecialChars();
37+ this . props . value = this . util
38+ . string ( this . props . value )
39+ . removeSpecialChars ( ) ;
4440 return this ;
4541 }
4642
@@ -62,13 +58,10 @@ export class CPFValueObject extends ValueObject<Prop> {
6258 * @example param "527.348.652-11"
6359 */
6460 compare ( cpf : string ) : boolean {
65- // const formattedCpf = this.util.string(cpf).removeSpecialChars();
66- // const instanceValue = this.util
67- // .string(this.props.value)
68- // .removeSpecialChars();
69-
70- const formattedCpf = removeSpecialCharsFromCpf ( cpf ) ;
71- const instanceValue = removeSpecialCharsFromCpf ( this . props . value ) ;
61+ const formattedCpf = this . util . string ( cpf ) . removeSpecialChars ( ) ;
62+ const instanceValue = this . util
63+ . string ( this . props . value )
64+ . removeSpecialChars ( ) ;
7265 return instanceValue === formattedCpf ;
7366 }
7467
0 commit comments