Closed audionerd closed 9 years ago
collection.add([ { id: 0, value: "zero" }, { id: 1, value: "one" } ]); collection.get(0); // expected { id: 0, value: "zero" }, but returns `undefined`
I think this is because of the check for !query on line 162 here:
!query
get: function (query, indexName) { if (!query) return; var index = this._indexes[indexName || this.mainIndex]; return index[query] || index[query[this.mainIndex]] || this._indexes.cid[query] || this._indexes.cid[query.cid]; },
https://github.com/AmpersandJS/ampersand-collection/blob/780e538192af04c3f206b5a224fc846cf3e25f85/ampersand-collection.js#L162
I thought this was surprising. Is it intentional?
@audionerd good catch. Fixed here https://github.com/AmpersandJS/ampersand-collection/pull/50/
This has been fixed by #37
I think this is because of the check for
!query
on line 162 here:https://github.com/AmpersandJS/ampersand-collection/blob/780e538192af04c3f206b5a224fc846cf3e25f85/ampersand-collection.js#L162
I thought this was surprising. Is it intentional?