Skip to content

Commit

Permalink
refactor(ability.extra): simplifies permittedFieldsOf method
Browse files Browse the repository at this point in the history
  • Loading branch information
stalniy committed Jul 4, 2019
1 parent 437d4e7 commit f92e472
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/casl-ability/src/extra.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ const getRuleFields = rule => rule.fields;
export function permittedFieldsOf(ability, action, subject, options = {}) {
const fieldsFrom = options.fieldsFrom || getRuleFields;
const uniqueFields = ability.possibleRulesFor(action, subject)
.slice(0)
.reverse()
.filter(rule => rule.matches(subject))
.reverse()
.reduce((fields, rule) => {
const names = fieldsFrom(rule);

Expand Down

0 comments on commit f92e472

Please sign in to comment.