Skip to content

Instantly share code, notes, and snippets.

@shinecita
Created October 26, 2012 19:14
Show Gist options
  • Save shinecita/3960820 to your computer and use it in GitHub Desktop.
Save shinecita/3960820 to your computer and use it in GitHub Desktop.
wtf
Model.hasOrganization = function (model, organization) {
if (!model.organizations) return false;
var organizationsIds = model.organizations.map(function(o){return o._id});
console.log("CHEKCING : orgs", organizationsIds, "orgId", organization._id, organizationsIds.filter(function(id){id === organization._id}))
return organizationsIds.indexOf(organization._id) != -1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment