ngrx-store-logger icon indicating copy to clipboard operation
ngrx-store-logger copied to clipboard

Added action filtering by function

Open solnat opened this issue 7 years ago • 1 comments

This pull request adds a way for the user to filter actions by providing a custom filter function instead of string arrays. The previous functionality of filtering with strings is (of course) retained. In my case, it proved to be useful when working with namespaced actions to allow me to ignore entire namespaces in a concise way.

Before:

const options: LoggerOptions = {
  filter:  {
    blacklist: ['entity/set-value', 'entity/update-value', 
      'entity/do-something', 'entity/some-other-action'
    ]
  }
} 

After:

const options: LoggerOptions = {
  filter: (actionType: string) => !actionType.startsWith('entity/');
}

solnat avatar May 13 '18 12:05 solnat

Sorry for the delay on this, lgtm. Would you mind updating the README to reflect this new option? Once that is done I will merge in, thanks! 👍

btroncone avatar Jun 03 '18 15:06 btroncone