Add object.requiredKeys and object.optionalKeys

Closes #510.