I need to create a function that uses lodash's "without" method, which involves an object property and an array of values, similar to the "include" method.
Here is my code for the "_.include()" function:
this.filters = {} //function for filtering data in table based on column name
this.columnName = 'id'
this.tempQuery = [1,2]
this.data = [
{
id: 1,
name: 'aaa',
rejectedNumber: 1
},
{
id: 2,
name: 'bbb',
rejectedNumber: 2
},
{
id: 3,
name: 'ccc',
rejectedNumber: 3
}
]
this.filters[this.columnName] = _.partial(_.includes, this.tempQuery);
this.filteredData = _.filter( this.data, _.conforms( this.filters ));
And here is the resulting output:
this.filteredData = [
{
id: 1,
name: 'aaa',
rejectedNumber: 1
},
{
id: 2,
name: 'bbb',
rejectedNumber: 2
}]
However, I am unable to achieve the same results with the "_.without" function.
this.filters[this.columnName] = _.partial(_.without, this.tempQuery);
Unfortunately, it did not work as expected and returned all the data...
Does anyone have any suggestions on how to implement this using lodash functions?