clear.js 389 B

123456789101112131415
  1. "use strict";
  2. var ensureObject = require("type/object/ensure")
  3. , ensure = require("type/ensure");
  4. var objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable;
  5. module.exports = function (object) {
  6. ensure(["object", object, ensureObject]);
  7. for (var key in object) {
  8. if (!objPropertyIsEnumerable.call(object, key)) continue;
  9. delete object[key];
  10. }
  11. return object;
  12. };