I have the following data:
var jobs = [
{
job_type: "Part Time",
latitude: 49.545068,
longitude: 0.760518,
title: "reiciendis",
industry: [
{
id: 1,
name: "development" },
{
id: 2,
name: "design"
}
]},
{
job_type: "Full Time",
latitude: 51.545068,
longitude: 0.460518,
title: "auteas",
industry: [
{
id: 1,
name: "development" },
{
id: 2,
name: "testing"
}
]
and I'd like to try and filter the results based on a users search parameters, namely the choice of industries for a job search, which populate an array:
var jobchoices = ["testing", "design"];
my lodash filter so far looks like this:
var self = this
return _.filter(this.jobs, function(item) {
return _.filter(item.industry, function(obj) {
return _.some(self.jobchoices, obj.name);
});
});
but it returns true for all jobs. This is my first time using lodash. What am I doing wrong? Secondly, could I continue chaining in this fashion to filter by another user choice, say by job type?
development,testinganddesignsupposed to be strings?