UNPKG

read-conf

Version:
27 lines (21 loc) 499 B
var createHash, hash, isString; isString = (o) => { return typeof o === "string" || o instanceof String; }; ({createHash} = require("crypto")); hash = (obj) => { return createHash("sha1").update(JSON.stringify(obj, (key, val) => { if (typeof val === "function") { return val.toString(); } else { return val; } })).digest("base64"); }; module.exports = (o) => { return o.util = { isString: isString, hash: hash }; }; module.exports.isString = isString;