Reputation: 997
I wanted to get the keys of an $data.Entity but I haven't found the solution on how to do it. I am not referring to the JSON keys but the Entity primary keys.
$data.Entity.extend("Kissa", {
name: { type: 'int', key: true }
, address : { type: 'int', key: true }
, age : { type: 'int' }
});
$data.EntityContext.extend("KISSA_DB", {
kissa: { type: $data.EntitySet, elementType: Kissa }
});
Now, I have an object like this and I wanted to get the keys which are "name" and "address".
var temp = new Kissa({name: "Kim", address: "Mars", age: 20});
Is there an available API like :
temp.getType().getKeys()
Upvotes: 0
Views: 116
Reputation: 59282
If temp
is just a plain Object, then you can just use Object.keys
and pass temp
to it.
console.log(Object.keys(temp));
Upvotes: 1