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

cpu-idle

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cpu-idle - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

9

index.js

@@ -14,2 +14,3 @@ 'use strict';

};
const PRECISION = 10000;
const CONFIG = Symbol('CONFIG');

@@ -123,7 +124,9 @@ const TIMES_TO_IDLE = Symbol('TIMES_TO_IDLE');

static [TIMES_TO_IDLE](times) {
if (!(times instanceof Object) || !times.idle || !times.total) {
if (!(times instanceof Object)
|| !Number.isInteger(times.idle) || times.idle <= 0
|| !Number.isInteger(times.total) || times.total <= 0) {
return 0.0;
}
const percent = Math.round(100 * times.idle / times.total) / 100;
// console.log(times.idle, times.total, percent);
const percent = Math.round(PRECISION * times.idle / times.total) / PRECISION;
console.log(times.idle, times.total, percent);
return percent;

@@ -130,0 +133,0 @@ }

{
"name": "cpu-idle",
"version": "1.0.1",
"version": "1.0.2",
"description": "Get cpu load info",

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

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