Gathering detailed insights and metrics for ngx-humanize-duration
Gathering detailed insights and metrics for ngx-humanize-duration
Gathering detailed insights and metrics for ngx-humanize-duration
Gathering detailed insights and metrics for ngx-humanize-duration
humanize-duration
Convert millisecond durations to English and many other languages.
@types/humanize-duration
TypeScript definitions for humanize-duration
humanize-ms
transform humanize time to ms
humanize-string
Convert a camelized/dasherized/underscored string into a humanized one: `fooBar-Baz_Faz` → `Foo bar baz faz`
npm install ngx-humanize-duration
54.8
Supply Chain
94
Quality
75.7
Maintenance
50
Vulnerability
98.6
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
6 Stars
14 Commits
3 Forks
2 Watching
18 Branches
1 Contributors
Updated on 10 Mar 2023
Minified
Minified + Gzipped
TypeScript (93.58%)
JavaScript (6.42%)
Cumulative downloads
Total Downloads
Last day
95%
39
Compared to previous day
Last week
-8.8%
155
Compared to previous week
Last month
8.8%
706
Compared to previous month
Last year
29.7%
6,937
Compared to previous year
4
Angular wrapper for Humanize Duration library. Provides Angular pipe and service.
1npm install humanize-duration ngx-humanize-duration
Import ngx-humanize-duration module in Angular app.
1import { NgxHumanizeDurationModule } from 'ngx-humanize-duration'; 2 3@NgModule({ 4 imports: [ 5 NgxHumanizeDurationModule 6 ], 7})
With pipe in templates
1<p> 2 {{ yearInMillieSeconds | humanizeDuration:{ delimiter: ' and ', largest:2 } }} 3</p>
With a service
1import { 2 NgxHumanizeDurationOptions, 3 NgxHumanizeDurationService, 4} from "ngx-humanize-duration"; 5 6@Injectable({ 7 providedIn: "root", 8}) 9export class MyService { 10 constructor(private ngxHumanizeDurationService: NgxHumanizeDurationService) {} 11 12 humanizeDuration(value: number, options?: NgxHumanizeDurationOptions) { 13 return this.ngxHumanizeDurationService.humanizeDuration(value, options); 14 } 15}
If you find yourself setting same options over and over again, you can set the defaults using forRoot method, which you can still override at Module or Component or Service level
1import { NgxHumanizeDurationModule, NgxHumanizerOptions } from 'ngx-humanize-duration'; 2 3const defaults: NgxHumanizerOptions = {}; 4 5@NgModule({ 6 imports: [ 7 NgxHumanizeDurationModule.forRoot(defaults) 8 ], 9})
If you have Lazy Loaded modules and you want to use the defaults that you have set using above method, just import the NgxHumanizeDurationModule
1import { NgxHumanizeDurationModule, NgxHumanizerOptions } from 'ngx-humanize-duration'; 2 3const defaults: NgxHumanizerOptions = {}; 4 5@NgModule({ 6 imports: [ 7 NgxHumanizeDurationModule 8 ], 9})
If you want to override the defaults at Module Level
1import { NgxHumanizeDurationModule, NgxHumanizerOptions } from 'ngx-humanize-duration'; 2 3const moduleLevelOptions: NgxHumanizerOptions = {}; 4 5@NgModule({ 6 imports: [ 7 NgxHumanizeDurationModule.forFeature(moduleLevelOptions) 8 ], 9})
If you want to override the defaults at Component level
1<p> 2 {{ yearInMillieSeconds | humanizeDuration:{ componentLevelOptions } }} 3</p>
If you want to override the defaults at Service level
1import { NgxHumanizeDurationService } from "ngx-humanize-duration"; 2 3@Injectable({ 4 providedIn: "root", 5}) 6export class MyService { 7 constructor(private ngxHumanizeDurationService: NgxHumanizeDurationService) {} 8 9 humanizeDuration() { 10 const humanizedDuration = this.ngxHumanizeDurationService.humanizeDuration( 11 value, 12 newOptions 13 ); 14 } 15}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 0/14 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
116 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More