Skip to content

Instantly share code, notes, and snippets.

@farynaio
Last active October 8, 2018 17:55
Show Gist options
  • Select an option

  • Save farynaio/c01fc5027d7251e18177f8cfacd01026 to your computer and use it in GitHub Desktop.

Select an option

Save farynaio/c01fc5027d7251e18177f8cfacd01026 to your computer and use it in GitHub Desktop.
Javascript Object Discriminator filter
function discriminator(data) {
if (!data) {
return null;
}
return data.filter(function(item) {
return item.age >= 30 && item.age <= 40;
});
}
function Person(name, age, gender) {
this.name = name;
this.age = age;
this.gender = gender;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment