8000 Undefined used as weak map key · Issue #1319 · lodash/lodash · GitHub
[go: up one dir, main page]

Skip to content

Undefined used as weak map key #1319

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

Closed
BorePlusPlus opened this issue Jul 6, 2015 · 6 comments
Closed

Undefined used as weak map key #1319

BorePlusPlus opened this issue Jul 6, 2015 · 6 comments
Labels

Comments

@BorePlusPlus
Copy link

Hi,

I am using lodash with node.js 0.12.5 and am getting following error thrown.

      return metaMap.get(func);
                     ^
TypeError: Invalid value used as weak map key
    at WeakMap.get (native)
    at getData (/home/bore/stuff/node_modules/lodash/index.js:3856:22)
    at isLaziable (/home/bore/stuff/node_modules/lodash/index.js:4142:18)
    at wrapper (/home/bore/stuff/node_modules/lodash/index.js:3524:17)
    at dropTableStep (/home/bore/stuff/src/event-summary.js:29:12)
    at /home/bore/stuff/node_modules/lodash/index.js:3337:35
    at arrayMap (/home/bore/stuff/node_modules/lodash/index.js:1431:25)
    at Function.map (/home/bore/stuff/node_modules/lodash/index.js:6693:14)
    ....

On a first glance it seems strange to use other as a lookup key here as all non-lodash functions will cause it to evaluate to undefined (thus causing the error).

@jdalton
Copy link
Member
jdalton commented Jul 6, 2015

Can you post a small repro so I can add a unit test.

@BorePlusPlus
Copy link
Author

Sure. I can try to isolate the issue on the train home...

@BorePlusPlus
Copy link
Author

This seems to do it:

var _ = require('lodash');

function run(a, b) {
    console.log('run', arguments);
}

_.curry(run)(1);

produces

/home/bore/projects/isolated/node_modules/lodash/index.js:3856
      return metaMap.get(func);
                     ^
TypeError: Invalid value used as weak map key
    at WeakMap.get (native)
    at getData (/home/bore/projects/isolated/node_modules/lodash/index.js:3856:22)
    at isLaziable (/home/bore/projects/isolated/node_modules/lodash/index.js:4142:18)
    at wrapper (/home/bore/projects/isolated/node_modules/lodash/index.js:3524:17)
    at Object.<anonymous> (/home/bore/projects/isolated/revolver.js:7:13)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)

@jdalton jdalton closed this as completed in c856e06 Jul 6, 2015
@jdalton jdalton added the bug label Jul 6, 2015
@jdalton
Copy link
Member
jdalton commented Jul 6, 2015

Patched!

@BorePlusPlus
Copy link
Author

Thanks

@lock
Copy link
lock bot commented Jan 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants
0