ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
1 lines • 3.26 kB
Source Map (JSON)
{"version":3,"file":"ng-zorro-antd-core-pipe.mjs","sources":["../../components/core/pipe/time-range.pipe.ts","../../components/core/pipe/nz-pipe.module.ts","../../components/core/pipe/public-api.ts","../../components/core/pipe/ng-zorro-antd-core-pipe.ts"],"sourcesContent":["/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { Pipe, PipeTransform } from '@angular/core';\n\nimport { timeUnits } from 'ng-zorro-antd/core/time';\nimport { padStart } from 'ng-zorro-antd/core/util';\n\n@Pipe({\n name: 'nzTimeRange',\n pure: true\n})\nexport class NzTimeRangePipe implements PipeTransform {\n transform(value: string | number, format: string = 'HH:mm:ss'): string {\n let duration = Number(value || 0);\n\n return timeUnits.reduce((current, [name, unit]) => {\n if (current.indexOf(name) !== -1) {\n const v = Math.floor(duration / unit);\n duration -= v * unit;\n return current.replace(new RegExp(`${name}+`, 'g'), (match: string) =>\n padStart(v.toString(), match.length, '0')\n );\n }\n return current;\n }, format);\n }\n}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { NgModule } from '@angular/core';\n\nimport { NzTimeRangePipe } from './time-range.pipe';\n\n@NgModule({\n imports: [NzTimeRangePipe],\n exports: [NzTimeRangePipe]\n})\nexport class NzPipesModule {}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nexport * from './nz-pipe.module';\nexport * from './time-range.pipe';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA;;;AAGG;MAWU,eAAe,CAAA;AAC1B,IAAA,SAAS,CAAC,KAAsB,EAAE,MAAA,GAAi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