UNPKG

leap-node

Version:

[![codecov](https://codecov.io/gh/leapdao/leap-node/branch/master/graph/badge.svg)](https://codecov.io/gh/leapdao/leap-node) [![Docker Repository on Quay](https://quay.io/repository/leapdao/leap-node/status "Docker Repository on Quay")](https://quay.io/re

22 lines (19 loc) 479 B
const { createHash } = require('crypto'); module.exports = function generateNetworkId(...args) { const networkId = createHash('sha256'); const data = args .map(el => { if (el instanceof Array) { return el.map(f => { if (typeof f === 'function') { return f.toString(); } return ''; }); } return el; }) .map(JSON.stringify) .join(); return networkId.update(data).digest('hex'); };