title: Prevent pushing duplicate object in array in Angular
body: <p>I have a child component that receives data via <code>@Input()</code> from parent component (array of objects). I map that data and push object in new array for each object from Input data array in ngOnChanges hook. My goal is to prevent duplicates objects being pushed in new array. Every time ngOnChanges fires new objects are being pushed to <code>admins</code> array. I've tried to use <code>some</code> method in if statement but it didn't help. Here is my OnChanges hook:</p>
  <pre><code>ngOnChanges() {
    this.adminsGroup.map(a =&gt; {
      this.authService.getSpecUser(a.user).subscribe(
        data =&gt; {
          data.position = a.permissions;
          this.admins.push(data);
        }
      )
    });
  }
  </code></pre>
  <p>So I want to ensure that there is no <code>data</code> already in <code>this.admins</code> array before pushing it. Any help would be appreciated.</p>