Advertisement
HeilTec

NodeOsInfo.js

Dec 8th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const os = require('os');
  2.  
  3. const allInfo = Object.keys(os);
  4.  
  5. const isOsFunction = (item) => typeof os[item] === "function";
  6. const getinfo = (info) => ({[info]: os[info]()});
  7.  
  8. const logItem = (item) => {
  9.     console.log(JSON.stringify(item,null,2));
  10.     return item;
  11. }
  12.  
  13. console.log("Show functions result:");
  14. allInfo.filter(isOsFunction).map(getinfo).map(logItem);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement