'use strict';

define(['src/util/api', 'lodash'], function (API, _) {

    function track(localName, defaultValue) {
        if (API.getData(localName)) return;
        var localValue = [];
        try {
            localValue = JSON.parse(window.localStorage.getItem(localName)) || [];
            if(!Array.isArray(localValue)) throw new Error('TrackArray expected an array in local storage');
            localValue = localValue.concat(defaultValue);
            localValue = _.uniqWith(localValue, _.isEqual);
        } catch (e) {
            console.error(e);
        }

        return API.createData(localName, localValue).then(function(data) {
            data.onChange(function() {
                localStorage.setItem(localName, JSON.stringify(data));
            });
        });
    }

    return track;
});

@@ -106,16 +106,28 @@
 ultValue
+, comparator
 ) %7B%0A    
@@ -166,16 +166,66 @@
 return;%0A
+        var comparator = comparator %7C%7C _.isEqual;%0A
         
@@ -557,25 +557,26 @@
 lValue, 
-_.isEqual
+comparator
 );%0A     

Add comparator for TrackArray