ensureObject.js 431 B

1234567891011121314151617
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = ensureObject;
  4. function ensureObject(obj) {
  5. for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  6. props[_key - 1] = arguments[_key];
  7. }
  8. while (props.length > 0) {
  9. var prop = props.shift();
  10. if (!obj[prop]) {
  11. obj[prop] = {};
  12. }
  13. obj = obj[prop];
  14. }
  15. }
  16. module.exports = exports.default;