'use strict' function id (e) { return e } var prop = require('../util/prop') var filter = require('./filter') //drop items you have already seen. module.exports = function unique (field, invert) { field = prop(field) || id var seen = {} return filter(function (data) { var key = field(data) if(seen[key]) return !!invert //false, by default else seen[key] = true return !invert //true by default }) }