UNPKG

@ngx-mask/core

Version:

[@ngx-mask/core](https://github.com/IKatsuba/ngx-mask#readme)

35 lines 1.62 kB
import { __assign, __decorate, __metadata, __param } from "tslib"; import { Inject, Injectable } from '@angular/core'; import { NGX_MASK_OPTIONS } from './tokens'; import { Mask } from './mask'; import * as i0 from "@angular/core"; import * as i1 from "./tokens"; var NgxMaskService = /** @class */ (function () { function NgxMaskService(options) { this.options = options; this.validateTokens(options.tokens); } NgxMaskService.prototype.applyMask = function (value, mask, options) { return Mask.applyMask(value, mask, __assign(__assign({}, this.options), options)); }; NgxMaskService.prototype.validateTokens = function (tokens) { var token = Object.keys((tokens !== null && tokens !== void 0 ? tokens : {})).find(function (key) { return key.length !== 1; }); if (token) { throw new Error("Token length must be 1! Actual token '" + token + "'"); } }; NgxMaskService.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: Inject, args: [NGX_MASK_OPTIONS,] }] } ]; }; NgxMaskService.ɵprov = i0.ɵɵdefineInjectable({ factory: function NgxMaskService_Factory() { return new NgxMaskService(i0.ɵɵinject(i1.NGX_MASK_OPTIONS)); }, token: NgxMaskService, providedIn: "root" }); NgxMaskService = __decorate([ Injectable({ providedIn: 'root' }), __param(0, Inject(NGX_MASK_OPTIONS)), __metadata("design:paramtypes", [Object]) ], NgxMaskService); return NgxMaskService; }()); export { NgxMaskService }; //# sourceMappingURL=mask.service.js.map