Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stockshark-util

Package Overview
Dependencies
Maintainers
0
Versions
444
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stockshark-util - npm Package Compare versions

Comparing version 1.0.444 to 1.0.445

2

package.json
{
"name": "stockshark-util",
"version": "1.0.444",
"version": "1.0.445",
"description": "util",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -120,3 +120,3 @@ const moment = require("moment-timezone")

toHumanizedDuration(seconds) {
toHumanizedDuration(seconds, abbreviate = false) {
if (!util.isNumber(seconds)) return ""

@@ -126,10 +126,17 @@

const units = {
seconds: abbreviate ? "s" : " seconds",
minutes: abbreviate ? "m" : " minutes",
hours: abbreviate ? "h" : " hours",
days: abbreviate ? "d" : " days",
}
if (duration.asSeconds() < 60) {
return Math.round(duration.asSeconds()) + " seconds"
return Math.round(duration.asSeconds()) + units.seconds
} else if (duration.asMinutes() < 60) {
return Math.round(duration.asMinutes()) + " minutes"
return Math.round(duration.asMinutes()) + units.minutes
} else if (duration.asHours() < 24) {
return duration.asHours().toFixed(1) + " hours"
return duration.asHours().toFixed(1) + units.hours
} else {
return duration.asDays().toFixed(1) + " days"
return duration.asDays().toFixed(1) + units.days
}

@@ -136,0 +143,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc