From 26e8293ee358e5568f2cbf138b8c0c1278a8698b Mon Sep 17 00:00:00 2001 From: Zalmoxisus Date: Sat, 6 Feb 2016 12:47:57 +0200 Subject: [PATCH] Add regex support Fix #5. --- README.md | 4 ++-- src/FilterMonitor.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a6880c1..3755691 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,8 @@ Also, you can wrap it into the [`DockMonitor`](https://github.com/gaearon/redux- Name | Description ------------- | ------------- -`blacklist` | An array of actions to be hidden in the child monitor. -`whitelist` | An array of actions to be shown. If specified, other than those actions will be hidden (the 'blacklist' parameter will be ignored). +`blacklist` | An array of actions (regex as string) to be hidden in the child monitor. +`whitelist` | An array of actions (regex as string) to be shown. If specified, other than those actions will be hidden (the 'blacklist' parameter will be ignored). ### License diff --git a/src/FilterMonitor.js b/src/FilterMonitor.js index 265ece9..38295ec 100644 --- a/src/FilterMonitor.js +++ b/src/FilterMonitor.js @@ -12,8 +12,8 @@ export default class FilterMonitor extends Component { isFiltered(action) { return ( - this.props.whitelist && this.props.whitelist.indexOf(action) !== -1 || - this.props.blacklist && this.props.blacklist.indexOf(action) === -1 + this.props.whitelist && action.match(this.props.whitelist.join('|')) || + this.props.blacklist && !action.match(this.props.blacklist.join('|')) ); }