thewei / react-native-store

A simple database base on react-native AsyncStorage.
https://github.com/thewei/react-native-store
Other
569 stars 74 forks source link

add null guards for *ById methods #24

Closed chandu0101 closed 8 years ago

chandu0101 commented 8 years ago

https://github.com/thewei/react-native-store/blob/master/libs/model.js#L172

result can be either null/array , return undefined if its null otherwise pop!

chandu0101 commented 8 years ago

i think an error object with id doesn't exist makes more sense than returning undefined , sorry to be the complaining guy instead of sending PR's, i don't have much experience with javascript i am from scala.js :) , if no one up for this i may send PR sometime in future :)

thewei commented 8 years ago

I fixed it in react-native-store@0.2.3.

chandu0101 commented 8 years ago

cool thanks,Its returning null now.how throwing error/rejecting promise because its not a successfull transaction!

thewei commented 8 years ago

use promise?

chandu0101 commented 8 years ago

hmm may be i am completely out of sync(sorry can't understand whats going in js) , *ByID calls are already returns Promise right ? if no id exist then we can reject promise in API level itself ...

thewei commented 8 years ago

Now return a promise object