Skip to content

Commit

Permalink
feat(memoize): refactor serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Apr 10, 2019
1 parent 13f7384 commit 6d0845c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/memoize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface MemoizeOptions<T extends AnyFunction = AnyFunction> {
get(key: string): any,
has(key: string): boolean,
},
serializer?(args: Parameters<T>): string,
serializer?(...args: Parameters<T>): string,
}

/**
Expand All @@ -27,7 +27,7 @@ export function memoize<T extends AnyFunction>(fn: T, options?: MemoizeOptions<T
} as any
}
if (options.serializer) {
fastMemoizeOptions.serializer = options.serializer as any
fastMemoizeOptions.serializer = args => options.serializer.apply(null, args as any)
}
}
return fastMemoize(fn, fastMemoizeOptions)
Expand Down

0 comments on commit 6d0845c

Please sign in to comment.