Skip to content

Commit

Permalink
Update dependencies (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyGu committed Nov 17, 2017
1 parent 5853862 commit 363e1e0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/constructs/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class Constant {
generate() {
const body = `
Object.defineProperty(${this.interface.name}, "${this.idl.name}", {
value: ${JSON.stringify(this.idl.value.value)},
value: ${utils.getDefault(this.idl.value)},
enumerable: true
});
Object.defineProperty(${this.interface.name}.prototype, "${this.idl.name}", {
value: ${JSON.stringify(this.idl.value.value)},
value: ${utils.getDefault(this.idl.value)},
enumerable: true
});
`;
Expand Down
2 changes: 1 addition & 1 deletion lib/constructs/enumeration.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Enumeration {
}

generate() {
const values = new Set(this.idl.values);
const values = new Set(this.idl.values.map(val => val.value));
if (values.size !== this.idl.values.length) {
throw new Error(`Duplicates found in ${this.name}'s enumeration values`);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
function getDefault(dflt) {
switch (dflt.type) {
case "boolean":
case "number":
case "string":
return JSON.stringify(dflt.value);
case "number":
return dflt.value;
case "null":
case "NaN":
return dflt.type;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"pn": "^1.0.0",
"prettier": "^1.5.3",
"webidl-conversions": "^4.0.0",
"webidl2": "^4.1.0"
"webidl2": "^8.1.0"
},
"devDependencies": {
"eslint": "^4.3.0",
"jest": "^20.0.4"
"jest": "^21.2.1"
},
"scripts": {
"test": "jest",
Expand Down

0 comments on commit 363e1e0

Please sign in to comment.