UNPKG

@justa/utilities

Version:

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

58 lines (54 loc) 1.66 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 */ var LegalDocumentPipe = /** @class */ (function () { function LegalDocumentPipe() { } /** * @param {?} value * @param {?=} args * @return {?} */ LegalDocumentPipe.prototype.transform = /** * @param {?} value * @param {?=} args * @return {?} */ function (value, args) { /** @type {?} */ var valueFormated = value ? value.replace(/\D/gi, '') : ''; if (valueFormated.length === 11) { return formatCpf(valueFormated); } else { return formatCnpj(valueFormated); } }; LegalDocumentPipe.decorators = [ { type: Pipe, args: [{ name: 'legalDocument', },] } ]; return LegalDocumentPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var UtilitiesModule = /** @class */ (function () { function UtilitiesModule() { } UtilitiesModule.decorators = [ { type: NgModule, args: [{ declarations: [LegalDocumentPipe], imports: [], exports: [LegalDocumentPipe], },] } ]; return UtilitiesModule; }()); export { LegalDocumentPipe, UtilitiesModule }; //# sourceMappingURL=justa-utilities.js.map