32 lines
1001 B
JavaScript
32 lines
1001 B
JavaScript
'use strict';
|
|
// ==================================================================================
|
|
// index.js
|
|
// ----------------------------------------------------------------------------------
|
|
// Description: System Information - library
|
|
// for Node.js
|
|
// Copyright: (c) 2014 - 2016
|
|
// Author: Sebastian Hildebrandt
|
|
// ----------------------------------------------------------------------------------
|
|
// License: MIT
|
|
// ==================================================================================
|
|
// 0. helper functions
|
|
// ----------------------------------------------------------------------------------
|
|
|
|
const os = require('os');
|
|
let _cores = 0;
|
|
|
|
function isFunction(functionToCheck) {
|
|
var getType = {};
|
|
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
}
|
|
|
|
function cores() {
|
|
if (_cores == 0) {
|
|
_cores = os.cpus().length;
|
|
}
|
|
return _cores;
|
|
}
|
|
|
|
exports.isFunction = isFunction;
|
|
exports.cores = cores;
|