holidayextras / jsonapi-client

Easily consume a json:api service in Javascript.
MIT License
68 stars 19 forks source link

Public method for getting the resource's ID? #73

Open multimeric opened 5 years ago

multimeric commented 5 years ago

We have a few ways of getting the resource ID: resource._getUid() works, but the underscore makes it look like an internal method I shouldn't depend on. resource.toJSON().id also works, but it processes the entire data structure which I don't need. Finally, resource.get('id') doesn't work, which surprises me.

Is there a recommended and stable way of getting a resource object's ID?