UNPKG

ngx-mask

Version:
46 lines 4.87 kB
import { NgModule } from '@angular/core'; import { config, INITIAL_CONFIG, initialConfig, NEW_CONFIG } from './config'; import { MaskApplierService } from './mask-applier.service'; import { MaskDirective } from './mask.directive'; import { MaskPipe } from './mask.pipe'; export class NgxMaskModule { static forRoot(configValue) { return { ngModule: NgxMaskModule, providers: [ { provide: NEW_CONFIG, useValue: configValue, }, { provide: INITIAL_CONFIG, useValue: initialConfig, }, { provide: config, useFactory: _configFactory, deps: [INITIAL_CONFIG, NEW_CONFIG], }, MaskApplierService, ], }; } static forChild() { return { ngModule: NgxMaskModule, }; } } NgxMaskModule.decorators = [ { type: NgModule, args: [{ exports: [MaskDirective, MaskPipe], declarations: [MaskDirective, MaskPipe], },] } ]; /** * @internal */ export function _configFactory(initConfig, configValue) { return configValue instanceof Function ? Object.assign(Object.assign({}, initConfig), configValue()) : Object.assign(Object.assign({}, initConfig), configValue); } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LW1hc2subW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LW1hc2stbGliL3NyYy9saWIvbmd4LW1hc2subW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBdUIsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRTlELE9BQU8sRUFBRSxNQUFNLEVBQUUsY0FBYyxFQUFFLGFBQWEsRUFBRSxVQUFVLEVBQWlCLE1BQU0sVUFBVSxDQUFDO0FBQzVGLE9BQU8sRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzVELE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNqRCxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBTXZDLE1BQU0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