1 | "use strict";
|
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7 | };
|
8 | Object.defineProperty(exports, "__esModule", { value: true });
|
9 | var core_1 = require("@angular/core");
|
10 | var moment = require("moment");
|
11 | var DurationPipe = (function () {
|
12 | function DurationPipe() {
|
13 | }
|
14 | DurationPipe.prototype.transform = function (value) {
|
15 | var args = [];
|
16 | for (var _i = 1; _i < arguments.length; _i++) {
|
17 | args[_i - 1] = arguments[_i];
|
18 | }
|
19 | if (typeof args === 'undefined' || args.length !== 1) {
|
20 | throw new Error('DurationPipe: missing required time unit argument');
|
21 | }
|
22 | return moment.duration(value, args[0]).humanize();
|
23 | };
|
24 | DurationPipe = __decorate([
|
25 | core_1.Pipe({ name: 'amDuration' })
|
26 | ], DurationPipe);
|
27 | return DurationPipe;
|
28 | }());
|
29 | exports.DurationPipe = DurationPipe;
|
30 |
|
\ | No newline at end of file |