0
UnderscoreJS
에는 두 배열간에 차이를 줄 수있는 _.difference
이라는 메서드가 있습니다. UnderscoreJS : 서로 다른 유형의 요소를 갖는 두 배열 간의 차이 찾기
배열 1 :
var obj1 = [
{
id: 1,
name: 'abc-1',
lname: 'xyz-1',
phone: 'xxxxxx1',
company: 'Comp-1',
address: 'Address-1',
country: 'C-1',
securityNo: 'xxxx-1'
},
{
id: 2,
name: 'abc-2',
lname: 'xyz-2',
phone: 'xxxxxx2',
company: 'Comp-2',
address: 'Address-2',
country: 'C-2',
securityNo: 'xxxx-2'
},
{
id: 3,
name: 'abc-3',
lname: 'xyz-3',
phone: 'xxxxxx3',
company: 'Comp-3',
address: 'Address-3',
country: 'C-3',
securityNo: 'xxxx-3'
}]
을 그리고 다른 배열이 제한된 속성이 포함되어
배열 2 :
var obj2 = [
{
id: 1,
name: 'abc-1',
lname: 'xyz-1'
},
{
id: 2,
name: 'abc-2',
lname: 'xyz-2'
}]
지금 내가 좋아하는이 두 배열의 차이를 적용 할 것 :
_.difference(obj1, obj2);
그리고 그 결과로 나에게 3 요소를 제공해야합니다.
그러나 이것을 달성 할 수있는 방법을 찾지 못했습니다.
답변보기 https://stackoverflow.com/questions/13147278/using-underscores-difference-method-on-arrays-of-objects. 이것은 Object comparaison 때문입니다. –