1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 1 1 112 112 196 196 174 174 168 6 6 174 3 171 | var t = require("../../types"); exports.ObjectExpression = function (node, parent, file) { var keys = []; for (var i in node.properties) { var prop = node.properties[i]; if (prop.computed || prop.kind !== "init") continue; var key = prop.key; if (t.isIdentifier(key)) { key = key.name; } else Eif (t.isLiteral(key)) { key = key.value; } else { continue; } if (keys.indexOf(key) >= 0) { throw file.errorWithNode(prop.key, "Duplicate property key"); } else { keys.push(key); } } }; |