Commit 4c9278e
Using dataSource[dataKey] leads to false results
Using `dataSource[dataKey]` has 2 issues:
1. It searches the complete prototype chain (which is unefficient)
2. If the resolved value is `0` or `false` the result is `false` (which isn't intended)
Example:
dataKey is 'id', it's value is zero:
e.g.
{
id: 0
}
So better to be explicit here, e.g. 👍
` if(dataSource.hasOwnProperty(dataKey)) `1 parent ee15067 commit 4c9278e
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
| 227 | + | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| |||
0 commit comments