Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
A timy timer package to time things !
npm i timerize
// If you use Node / CommonJS / not a ES2015 module compiler
const Timer = require('timerize').default;
// If you use TypeScript / a ES2015 module-compatible navigator/compiler
import Timer from 'timerize';
const timer = new Timer;
console.log(timer.elapsed); // 12 for exemple
// Change the format of number output
timer.format = "s";
console.log(timer.elapsed); // 1.123 for exemple
// Change the default format for every new Timer instances and instance with unchanged format
Timer.default_format = "s";
timer.pause();
// do things
timer.start();
// ...
Important note:
The timer does not consume any resource when it is "running". Calculations are made when you get the elapsed time.
You can leave him without call pause()
and waiting for it became garbage-collected.
You can provide two optional arguments: time (starting time, default Date.now()
) and format (default Timer.default_format
).
Timer automatically starts after instanciation, you do not need to call .start()
!
const timer = new Timer(Date.now(), "s");
Get elapsed time according to desired format
const elapsed_time = timer.elapsed;
Change the elapsed time format output.
Default format is ms
.
Accepted formats are ms
, s
, m
, h
and d
, for milliseconds, seconds, minutes, hours and days.
timer.format = "m";
You can also change defaut format for new instances (and instances that does not have a specified format) with Timer.default_format
Timer.default_format = "s";
Pause the timer. You can optionnaly specify a number of milliseconds of how much time the timer should restart automatically.
If the timer is already paused, it will have no action.
timer.pause(ms?);
Start the timer after a pause.
If the timer was not paused, it will be reset.
timer.start();
Check if the timer is paused.
if (timer.paused) {
// do sth
}
FAQs
> A timy timer package to time things !
The npm package timerize receives a total of 5 weekly downloads. As such, timerize popularity was classified as not popular.
We found that timerize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.