如何调用数组中所有javascript个成员函数? [node.js]

How to call all javascript member functions in an array? [node.js]

我想遍历并调用与 "os"

关联的所有成员函数
var os = require('os'); 
var keye = Object.keys(os);
keye.forEach(f => os.f());

Prototype:

{ endianness: [Function: getEndianness],
  hostname: [Function: getHostname],
  loadavg: [Function: getLoadAvg],
  uptime: [Function: getUptime],
  freemem: [Function: getFreeMem],
  totalmem: [Function: getTotalMem],
  cpus: [Function: getCPUs],
  type: [Function: getOSType],
  release: [Function: getOSRelease],
  networkInterfaces: [Function: getInterfaceAddresses],
  arch: [Function],
  platform: [Function],
  tmpdir: [Function],
  tmpDir: [Function],
  getNetworkInterfaces: [Function: deprecated],
  EOL: '\r\n' }

你需要这样的东西:

Object.keys(os).forEach(function (key) {
    if (typeof os[key] === 'function') {
        console.log(key, os[key]());
    }
});