angular-iban
Version:
Angular directives and pipes for IBAN
81 lines (73 loc) • 3.59 kB
JavaScript
import * as i0 from '@angular/core';
import { Directive, Pipe, NgModule } from '@angular/core';
import { NG_VALIDATORS } from '@angular/forms';
import * as IBAN from 'iban';
class ValidatorService {
static validateIban(c) {
if (c.value && !IBAN.isValid(c.value)) {
return { iban: { value: c.value } };
}
return null;
}
}
class IbanValidatorDirective {
validate(c) {
return ValidatorService.validateIban(c);
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: IbanValidatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.1", type: IbanValidatorDirective, isStandalone: false, selector: "[ibanValidator]", providers: [{ provide: NG_VALIDATORS, useExisting: IbanValidatorDirective, multi: true }], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: IbanValidatorDirective, decorators: [{
type: Directive,
args: [{
selector: '[ibanValidator]',
providers: [{ provide: NG_VALIDATORS, useExisting: IbanValidatorDirective, multi: true }],
standalone: false
}]
}] });
class IbanFormatterPipe {
transform(value, args) {
if (IBAN.isValid(value)) {
return IBAN.printFormat(value, ' ');
}
return value;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: IbanFormatterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.1", ngImport: i0, type: IbanFormatterPipe, isStandalone: false, name: "ibanFormatter" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: IbanFormatterPipe, decorators: [{
type: Pipe,
args: [{
name: 'ibanFormatter',
standalone: false
}]
}] });
class AngularIbanModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: AngularIbanModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.1", ngImport: i0, type: AngularIbanModule, declarations: [IbanValidatorDirective,
IbanFormatterPipe], exports: [IbanValidatorDirective,
IbanFormatterPipe] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: AngularIbanModule }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: AngularIbanModule, decorators: [{
type: NgModule,
args: [{
declarations: [
IbanValidatorDirective,
IbanFormatterPipe,
],
imports: [],
exports: [
IbanValidatorDirective,
IbanFormatterPipe,
],
}]
}] });
/*
* Public API Surface of angular-iban
*/
/**
* Generated bundle index. Do not edit.
*/
export { AngularIbanModule, IbanFormatterPipe, IbanValidatorDirective, ValidatorService };
//# sourceMappingURL=angular-iban.mjs.map