Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing serializer causes TypeError: p is not a function #6

Closed
aaronmccall opened this issue Apr 9, 2019 · 2 comments
Closed

Missing serializer causes TypeError: p is not a function #6

aaronmccall opened this issue Apr 9, 2019 · 2 comments
Assignees
Labels
bug Something isn't working Fixed v1.1.3

Comments

@aaronmccall
Copy link

Version 1.1.1 removes the default serializer arg (serializer = value => JSON.stringify(value)).

This breaks the case where the single argument to the memoized function is itself a function:

> const memoize = require('nano-memoize')
undefined
> const memoized = memoize(fn => o => fn(o))
undefined
> const myFunc = memoized(o => console.log(o))
TypeError: p is not a function
    at Object.<anonymous> (/Users/aaronmccall/Projects/phytochrome-web-ui/node_modules/nano-memoize/index.js:35:118)
>
@anywhichway
Copy link
Owner

anywhichway commented Apr 9, 2019 via email

@anywhichway anywhichway self-assigned this Apr 9, 2019
@anywhichway anywhichway added bug Something isn't working Fixed v1.1.3 labels Apr 9, 2019
@anywhichway
Copy link
Owner

@aaronmccall Fixed, although not by re-introducing default arg. instead, do a type check for "function" in the code and branch. unit test added. thanks for finding the bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed v1.1.3
Projects
None yet
Development

No branches or pull requests

2 participants