code: function ensureArray(object, key) {
    if (!object[key]) {
      object[key] = [];
    }
    if (!Array.isArray(object[key])) {
      throw new Error("Can't perform array operation on non-array field");
    }
  }
docs: Ensures `object` has an array at `key`. Creates array if `key` doesn't exist. Will throw if value for `key` exists and is not Array.