Front end of the Slack clone application.

flatten.js 355B

123456789101112131415161718
  1. "use strict";
  2. var isPlainObject = require("./is-plain-object")
  3. , forEach = require("./for-each")
  4. , process;
  5. process = function self(value, key) {
  6. if (isPlainObject(value)) forEach(value, self, this);
  7. else this[key] = value;
  8. };
  9. module.exports = function (obj) {
  10. var flattened = {};
  11. forEach(obj, process, flattened);
  12. return flattened;
  13. };