I have a Javascript object (it happens to be the database
object from the CloudKit library, but that's not important). As per How to get all properties values of a Javascript Object (without knowing the keys)? I have tried the following to list this object's keys:
console.log(Object.keys(database))
console.log(Object.getOwnPropertyNames(database))
console.log(Reflect.ownKeys(database))
And they all log:
[ '_container', '_isPublic', '_partition' ]
(EDIT: I also tried using a for
/in
loop, and it also logged the above.)
However, I know this object also has performQuery
and saveRecords
methods, and if I log them specifically I can see them:
console.log(database.performQuery)
// logs [Function: value]
console.log(database.saveRecords);
// logs [Function: value]
Can anyone explain how I can get a list of all of this object's keys, including the "secret" methods?