AssignedNodesOptions.js 892 B

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