Check if a property exists in the original object before injecting its hashed field#200
Check if a property exists in the original object before injecting its hashed field#200TissuePowder wants to merge 1 commit into
Conversation
|
Mind adding the tests for your usecase here? thanks |
|
I didn't test it extensively before, apologies. Found some major problems after I used your jest testing file. Doing the |
|
Can we just remove the id key from json if it's empty? Probably not the best solution, but easier. |
|
Sorry, I don't think I understand the problem, but here's my understanding of it and please let me know if I'm misunderstanding it:
You can specify your own Also, when you say it doesn't work, how exactly does it not work (could you perhaps push the failing test case to the PR so I can see what's going on)? Does it not work in the serialization (
The same thing as above - I'm not sure what you're referring to here. Which JSON (the original JSON, or the serialized JSON)? In serialization or deserialization? What exactly constitutes "empty" (an empty string? null? undefined?) Thanks |
|
In last test I used the jest test file Anyway, I'll try to explain it better. For the first failed case with algolia, (https://github.com/JaneJeon/objection-hashid/blob/master/index.test.js#L124), value of Now the Exactly same happens with composite primary key (https://github.com/JaneJeon/objection-hashid/blob/master/index.test.js#L156). The specified primary key can be
I am talking about the serialized json ( Let me know if I need to explain more. |
|
Sorry I haven't been able to reply sooner (I'm at the airport), but I promise to get back to this soon. If I don't, just @ me |
Uses
hasOwnProperty()for checking, notin.