Skip to content

Instantly share code, notes, and snippets.

const fs = require('fs');
const { exec } = require("child_process");
const processPackages = () => {
console.log('Start package.json process ')
const _package = JSON.parse(fs.readFileSync('./package.json', 'utf8'))
const _packageLock = JSON.parse(fs.readFileSync('./package-lock.json', 'utf8'))
const dependencies = _package['dependencies']
const devDependencies = _package['devDependencies']
@rpoveda
rpoveda / eventemitter.js
Created June 22, 2018 19:21 — forked from mudge/eventemitter.js
A very simple EventEmitter in pure JavaScript (suitable for both node.js and browsers).
/* Polyfill indexOf. */
var indexOf;
if (typeof Array.prototype.indexOf === 'function') {
indexOf = function (haystack, needle) {
return haystack.indexOf(needle);
};
} else {
indexOf = function (haystack, needle) {
var i = 0, length = haystack.length, idx = -1, found = false;
@rpoveda
rpoveda / cpu.js
Created July 24, 2014 17:58 — forked from bag-man/cpu.js
var os = require("os");
//Create function to get CPU information
function cpuAverage() {
//Initialise sum of idle and time of cores and fetch CPU info
var totalIdle = 0, totalTick = 0;
var cpus = os.cpus();
//Loop through CPU cores