@@ -2,6 +2,7 @@ import { ValueObject } from '../core';
22import { Result } from '../core' ;
33import isValidCpfDigit , {
44 formatValueToCpfPattern ,
5+ removeSpecialCharsFromCpf ,
56} from './check-cpf-digit.util' ;
67const regexCpf =
78 / ^ ( [ 0 - 9 ] { 3 } ) [ \. ] ( (? ! \1) [ 0 - 9 ] { 3 } ) [ \. ] ( [ 0 - 9 ] { 3 } ) [ - ] ( [ 0 - 9 ] { 2 } ) $ | ^ [ 0 - 9 ] { 11 } $ / ;
@@ -35,9 +36,11 @@ export class CPFValueObject extends ValueObject<Prop> {
3536 * @example after "52734865211"
3637 */
3738 removeSpecialChars ( ) : CPFValueObject {
38- this . props . value = this . util
39- . string ( this . props . value )
40- . removeSpecialChars ( ) ;
39+ this . props . value = removeSpecialCharsFromCpf ( this . props . value ) ;
40+
41+ // this.props.value = this.util
42+ // .string(this.props.value)
43+ // .removeSpecialChars();
4144 return this ;
4245 }
4346
@@ -59,10 +62,13 @@ export class CPFValueObject extends ValueObject<Prop> {
5962 * @example param "527.348.652-11"
6063 */
6164 compare ( cpf : string ) : boolean {
62- const formattedCpf = this . util . string ( cpf ) . removeSpecialChars ( ) ;
63- const instanceValue = this . util
64- . string ( this . props . value )
65- . removeSpecialChars ( ) ;
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 ) ;
6672 return instanceValue === formattedCpf ;
6773 }
6874
0 commit comments