Skip to content

Commit

Permalink
Clean up underscore chain and check that parsed fields are indeed str…
Browse files Browse the repository at this point in the history
…ings.
  • Loading branch information
Young Hahn committed Mar 8, 2011
1 parent 5b9abda commit f895dc9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions shared/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,11 @@ var Project = Backbone.Model.extend({
fields = fields
.concat(full.match(/\[([\w\d]+)\]/g))
.concat(teaser.match(/\[([\w\d]+)\]/g));
fields = _.uniq(_.map(fields, function(field) {
return field.replace(/[\[|\]]/g, '');
}));
fields = _(fields).chain()
.filter(_.isString)
.map(function(field) { return field.replace(/[\[|\]]/g, ''); })
.uniq()
.value();
return fields;
}
});
Expand Down

0 comments on commit f895dc9

Please sign in to comment.