You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if(values(updatedValues).indexOf(opts.updatedValues)===-1)thrownewError('diff-arrays-of-objects error: "options.updatedValues" must be a one of the ".updatedValues" but is not');
35
35
if(!isFunction(opts.compareFunction))thrownewError('diff-arrays-of-objects error: "options.compareFunction" must be a function but is not');
36
36
37
-
// arrays to hold the id values in the two arrays
38
-
constfirstIds=[];
39
-
constsecondIds=[];
37
+
// arrays to hold the id values in the two arrays
38
+
constfirstIds=first.map(i=>i[idField]);
39
+
constsecondIds=second.map(i=>i[idField]);
40
40
41
41
// index the first array by its id values.
42
42
// if first is [{ id: 1, a: 1 }, { id: 2, a: 3 }] then
43
43
// firstIndex will be { 1: { id: 1, a: 1 }, 2: { id: 2, a: 3 } }
44
-
// "getKey" has a side-effect of pushing the id value into firstIds; this saves on another iteration through "first"
0 commit comments