FilePropertyBag.js 1020 B

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. const conversions = require("webidl-conversions");
  3. const utils = require("./utils.js");
  4. const BlobPropertyBag = require("./BlobPropertyBag.js");
  5. exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => {
  6. BlobPropertyBag._convertInherit(globalObject, obj, ret, { context });
  7. {
  8. const key = "lastModified";
  9. let value = obj === undefined || obj === null ? undefined : obj[key];
  10. if (value !== undefined) {
  11. value = conversions["long long"](value, {
  12. context: context + " has member 'lastModified' that",
  13. globals: globalObject
  14. });
  15. ret[key] = value;
  16. }
  17. }
  18. };
  19. exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => {
  20. if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
  21. throw new globalObject.TypeError(`${context} is not an object.`);
  22. }
  23. const ret = Object.create(null);
  24. exports._convertInherit(globalObject, obj, ret, { context });
  25. return ret;
  26. };