Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F9583324
time-units.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
515 B
Referenced Files
None
Subscribers
None
time-units.js
View Options
function
time_units
(
from
,
to
,
amount
)
{
const
formats
=
{
'h'
:
3600000
,
'm'
:
60000
,
's'
:
1000
,
'ms'
:
1
}
amount
=
new
Number
(
amount
);
if
(
!
formats
[
from
]
||
!
formats
[
to
])
{
throw
new
Error
(
'Please provide a valid time format'
);
}
if
(
!
amount
||
typeof
amount
.
valueOf
()
!==
'number'
)
{
throw
new
Error
(
'Please provide a valid amount to convert'
);
}
return
(
formats
[
from
]
/
formats
[
to
]).
toPrecision
(
8
);
}
module
.
exports
=
time_units
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 11, 09:23 (1 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
984113
Default Alt Text
time-units.js (515 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment