UNPKG

@justa/utilities

Version:

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.1.2.

47 lines (43 loc) 1.29 kB
import { Pipe, NgModule } from '@angular/core'; import { formatCpf, formatCnpj } from '@brazilian-utils/formatters'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class LegalDocumentPipe { /** * @param {?} value * @param {?=} args * @return {?} */ transform(value, args) { /** @type {?} */ const valueFormated = value ? value.replace(/\D/gi, '') : ''; if (valueFormated.length === 11) { return formatCpf(valueFormated); } else { return formatCnpj(valueFormated); } } } LegalDocumentPipe.decorators = [ { type: Pipe, args: [{ name: 'legalDocument', },] } ]; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class UtilitiesModule { } UtilitiesModule.decorators = [ { type: NgModule, args: [{ declarations: [LegalDocumentPipe], imports: [], exports: [LegalDocumentPipe], },] } ]; export { LegalDocumentPipe, UtilitiesModule }; //# sourceMappingURL=justa-utilities.js.map