function dedupeArray(arr) {
  return arr.reduce(
    (p, item) => {
      const type = item.type || item.context.type;
      const name = item.name || item.context.name;
      const id = [type, name].join('|');

      if (p.temp.indexOf(id) === -1) {
        p.out.push(item);
        p.temp.push(id);
      }
      return p;
    },
    { temp: [], out: [] }
  ).out;
}
function dedupeArray(arr) {
  return arr.reduce(
    (p, item) => {
      const type = item.type || item.context.type;
      const name = item.name || item.context.name;
      const id = [type, name].join('|');

      if (p.temp.indexOf(id) === -1) {
        p.out.push(item);
        p.temp.push(id);
      }
      return p;
    },
    { temp: [], out: [] }
  ).out;
}
function dedupeArray ( arr ) { return arr . reduce ( ( p , item ) => { const type = item . type || item . context . type ; const name = item . name || item . context . name ; const id = [ type , name ] . join ( '|' ) ; if ( p . temp . indexOf ( id ) === - 1 ) { p . out . push ( item ) ; p . temp . push ( id ) ; } return p ; } , { temp : [ ] , out : [ ] } ) . out ; }
Remove duplicate objects in `require` and `usedBy` arrays. Array objects have
`name` and `type` properties, sometimes nested in a `context` object.
@param {Array} arr - array with potential duplicates
@return {Array} deduped array
Remove duplicate objects in require and usedBy arrays . Array objects have name and type properties sometimes nested in a context object .