Socket
Socket
Sign inDemoInstall

webidl2js

Package Overview
Dependencies
Maintainers
2
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webidl2js - npm Package Compare versions

Comparing version 5.1.1 to 6.0.0

46

lib/constructs/interface.js

@@ -69,11 +69,11 @@ "use strict";

},
toString: {
value: function toString() {
return "[object ${this.name}Iterator]";
},
writable: true,
[Symbol.toStringTag]: {
value: "${this.name}Iterator",
writable: false,
enumerable: false,
configurable: true
}
});`;
});
`;
}

@@ -102,4 +102,4 @@ };

this.str += `
if (!this || this[impl] || !(this instanceof ${this.name})) {
throw new TypeError("Failed to construct '${this.name}': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");
if (!new.target) {
throw new TypeError("Failed to construct '${this.name}'. Please use the 'new' operator; this constructor cannot be called as a function.");
}

@@ -122,4 +122,4 @@ if (arguments.length < ${minConstructor.nameList.length}) {

if (this.idl.inheritance) {
this.str += `${this.name}.prototype = Object.create(${this.idl.inheritance}.interface.prototype);
${this.name}.prototype.constructor = ${this.name};\n`;
this.str += `Object.setPrototypeOf(${this.name}.prototype, ${this.idl.inheritance}.interface.prototype);
Object.setPrototypeOf(${this.name}, ${this.idl.inheritance}.name);\n`;
}

@@ -363,26 +363,2 @@ };

Interface.prototype.generateToString = function () {
let hasToString = false;
for (const member of this.idl.members) {
if (member.stringifier || member.name === "toString") {
hasToString = true;
}
}
if (!hasToString) {
this.str += `\n${this.name}.prototype.toString = function () {
if (this === ${this.name}.prototype) {
return "[object ${this.name}Prototype]";
}`;
if (this.idl.inheritance) {
this.str += `
return ${this.idl.inheritance}.interface.prototype.toString.call(this);`;
} else {
this.str += `
return this[impl].toString();`;
}
this.str += `
};\n`;
}
};
Interface.prototype.generateSymbols = function () {

@@ -400,2 +376,3 @@ const unscopables = {};

}
this.str += `\n${this.name}.prototype[Symbol.toStringTag] = ${JSON.stringify(this.name)};\n`;
};

@@ -418,3 +395,2 @@

this.generateOperations();
this.generateToString();
this.generateAttributes();

@@ -421,0 +397,0 @@

@@ -58,3 +58,3 @@ "use strict";

str += parameterConversions.body;
if (overloads.every((overload) => conversions[overload.operation.idlType.idlType])) {
if (!this.idl.stringifier && overloads.every((overload) => conversions[overload.operation.idlType.idlType])) {
str += `

@@ -61,0 +61,0 @@ return ${callOn}.${name}.apply(${callOn}, args);

@@ -96,19 +96,20 @@ "use strict";

str += `
const isAlwaysZeroArgs = !isVariadic && maxArguments === 0;
if (!isAlwaysZeroArgs) {
const extraClause = !isVariadic ? ` && i < ${maxArguments}` : ``;
str += `\n
const args = [];
for (let i = 0; i < arguments.length`;
if (!isVariadic) {
str += ` && i < ${maxArguments}`;
}
str += `; ++i) {
for (let i = 0; i < arguments.length${extraClause}; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}`;
for (let i = 0; i < typeConversions.length; ++i) {
if (typeConversions[i] === null) {
continue;
for (let i = 0; i < typeConversions.length; ++i) {
if (typeConversions[i] === null) {
continue;
}
const conv = module.exports.generateVarConversion(`args[${i}]`, typeConversions[i], maxConstructor.operation.arguments[i].extAttrs, customTypes);
Object.assign(requires, conv.requires);
str += conv.body;
}
const conv = module.exports.generateVarConversion(`args[${i}]`, typeConversions[i], maxConstructor.operation.arguments[i].extAttrs, customTypes);
Object.assign(requires, conv.requires);
str += conv.body;
}

@@ -115,0 +116,0 @@ return {

{
"name": "webidl2js",
"version": "5.1.1",
"version": "6.0.0",
"description": "Auto-generates class structures for WebIDL specifications",

@@ -5,0 +5,0 @@ "main": "lib/transformer.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc