@@ -15,6 +15,7 @@ const DEFAULT_OPTIONS = {
1515 resetTypes : [ ] ,
1616 ignoreTypes : [ ] ,
1717 shouldOverwriteState : ( ) => false ,
18+ isIgnored : ( ) => false ,
1819} ;
1920
2021/**
@@ -26,6 +27,9 @@ const DEFAULT_OPTIONS = {
2627 * clear past.
2728 * @param {?Array } options.ignoreTypes Action types upon which to
2829 * avoid history tracking.
30+ * @param {?Function } options.isIgnored Function given action, to
31+ * return true if intended to
32+ * avoid history tracking.
2933 * @param {?Function } options.shouldOverwriteState Function receiving last and
3034 * current actions, returning
3135 * boolean indicating whether
@@ -34,13 +38,14 @@ const DEFAULT_OPTIONS = {
3438 *
3539 * @return {Function } Higher-order reducer.
3640 */
37- const withHistory = ( options = { } ) => ( reducer ) => {
41+ const withHistory = ( options ) => ( reducer ) => {
3842 options = { ...DEFAULT_OPTIONS , ...options } ;
3943
40- // `ignoreTypes` is simply a convenience for `shouldOverwriteState`
44+ // `ignoreTypes`, `isIgnored` are conveniences for `shouldOverwriteState`
4145 options . shouldOverwriteState = overSome ( [
4246 options . shouldOverwriteState ,
4347 ( action ) => includes ( options . ignoreTypes , action . type ) ,
48+ ( action ) => options . isIgnored ( action ) ,
4449 ] ) ;
4550
4651 const initialState = {
0 commit comments