You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
resolve: (root, args, request) => {
test = { uuid: '1234', description: 'lead singer of the Doors' };
console.log('result: ' + Object.prototype.hasOwnProperty.call(args.person, 'description'));
// XXX This fails!: console.log('result: ' + args.person.hasOwnProperty('description'));
console.log('result: ' + test.hasOwnProperty('description'));
return db.personUpdate(request.user, args.person);
}
If I try to use args.person.hasOwnProperty('description') I get the error hasOwnProperty is not a function. I'm forced to use Object.prototype.hasOwnProperty.call per this issue in another module
Note that if I create an object similar to args.person I don't get an error. See the test example in the code snippet.
I'm not enough of a javascript guru to say why this is happening, but it is a gotcha for when I"m attempting an update, where I merge the update with the existing object depending on what attributes are set in the update. My unit tests for the database pass (e.g. just like the test object above), but then fails when I attempt have graphql-express use my database.
Given a resolve function that looks like
If I try to use
args.person.hasOwnProperty('description')I get the errorhasOwnProperty is not a function. I'm forced to useObject.prototype.hasOwnProperty.callper this issue in another moduleNote that if I create an object similar to args.person I don't get an error. See the
testexample in the code snippet.I'm not enough of a javascript guru to say why this is happening, but it is a gotcha for when I"m attempting an update, where I merge the update with the existing object depending on what attributes are set in the update. My unit tests for the database pass (e.g. just like the
testobject above), but then fails when I attempt have graphql-express use my database.I've checked, and there is no attribute 'hasOwnProperty' on args.person, per the Mozilla description of Object.hasOwnProperty