Skip to content

Commit

Permalink
fix: cast pattern as StoreFunction
Browse files Browse the repository at this point in the history
fix: conditional when `fn` is not function
  • Loading branch information
dimaslanjaka committed May 18, 2023
1 parent 6aee1f3 commit 4a61ca5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/extend/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class Processor {
register(fn: StoreFunction): void;
register(pattern: patternType, fn: StoreFunction): void;
register(pattern: patternType | StoreFunction, fn?: StoreFunction) {
if (!fn) {
if (typeof fn !== 'function') {
if (typeof pattern === 'function') {
fn = pattern;
fn = pattern as StoreFunction;
pattern = /(.*)/;
} else {
throw new TypeError('fn must be a function');
Expand Down

0 comments on commit 4a61ca5

Please sign in to comment.