diff --git a/src/Store/ordered-dictionary.ts b/src/Store/ordered-dictionary.ts index d604586..a1a7af1 100644 --- a/src/Store/ordered-dictionary.ts +++ b/src/Store/ordered-dictionary.ts @@ -61,7 +61,15 @@ const makeOrderedDictionary = function(idGetter: (item: T) => string) { Object.keys(dict).forEach(key => { delete dict[key] }) }, filter: (contain: (item: T) => boolean) => { - //const copy = + let i = 0 + while(i < array.length) { + if(!contain(array[i])) { + delete dict[idGetter(array[i])] + array.splice(i, 1) + } else { + i += 1 + } + } } } }