UNPKG

ngx-numeral

Version:

An Angular pipe module for interfacing the Awesome Numeraljs library.

97 lines (96 loc) 3.6 kB
import { Pipe, Inject, InjectionToken } from "@angular/core"; import * as numeral from "numeral"; import * as i0 from "@angular/core"; export var DEFAULT_NUMERAL = new InjectionToken("DEFAULT_NUMERAL"); var NumeralPipe = /** @class */ (function () { function NumeralPipe(value) { this.numeral = numeral(value); } NumeralPipe.prototype.transform = function (value, format) { return numeral(value).format(format); }; Object.defineProperty(NumeralPipe.prototype, "version", { get: function () { return this.numeral.version; }, enumerable: false, configurable: true }); Object.defineProperty(NumeralPipe.prototype, "isNumeral", { get: function () { return this.numeral.isNumeral; }, enumerable: false, configurable: true }); NumeralPipe.prototype.locale = function (key) { return this.numeral.locale(key); }; NumeralPipe.prototype.register = function (what, key, value) { return this.numeral.register(what, key, value); }; NumeralPipe.prototype.zeroFormat = function (format) { return this.numeral.zeroFormat(format); }; NumeralPipe.prototype.nullFormat = function (format) { return this.numeral.nullFormat(format); }; NumeralPipe.prototype.defaultFormat = function (format) { return this.numeral.defaultFormat(format); }; NumeralPipe.prototype.clone = function () { return new NumeralPipe(this.numeral.clone().value()); }; NumeralPipe.prototype.format = function (inputString, roundingFunction) { return this.numeral.format(inputString, roundingFunction); }; NumeralPipe.prototype.formatCurrency = function (inputString) { return this.numeral.formatCurrency(inputString); }; NumeralPipe.prototype.unformat = function (inputString) { return this.numeral.unformat(inputString); }; NumeralPipe.prototype.value = function () { return this.numeral.value(); }; NumeralPipe.prototype.valueOf = function () { return this.numeral.valueOf(); }; NumeralPipe.prototype.set = function (value) { this.numeral.set(value); return this; }; NumeralPipe.prototype.add = function (value) { this.numeral.add(value); return this; }; NumeralPipe.prototype.subtract = function (value) { this.numeral.subtract(value); return this; }; NumeralPipe.prototype.multiply = function (value) { this.numeral.multiply(value); return this; }; NumeralPipe.prototype.divide = function (value) { this.numeral.divide(value); return this; }; NumeralPipe.prototype.difference = function (value) { return this.numeral.difference(value); }; NumeralPipe.prototype.validate = function (value, culture) { return this.numeral.validate(value, culture); }; NumeralPipe.ɵfac = function NumeralPipe_Factory(t) { return new (t || NumeralPipe)(i0.ɵɵdirectiveInject(DEFAULT_NUMERAL, 16)); }; NumeralPipe.ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "numeral", type: NumeralPipe, pure: true }); return NumeralPipe; }()); export { NumeralPipe }; (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NumeralPipe, [{ type: Pipe, args: [{ name: "numeral" }] }], function () { return [{ type: undefined, decorators: [{ type: Inject, args: [DEFAULT_NUMERAL] }] }]; }, null); })();