Sebastian Hildebrandt f5eb895bed code refactoring
2016-11-03 12:06:46 +01:00

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;