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

TypeError: squarify is not a function #325

Open
kmorte opened this issue Oct 24, 2021 · 0 comments
Open

TypeError: squarify is not a function #325

kmorte opened this issue Oct 24, 2021 · 0 comments

Comments

@kmorte
Copy link

kmorte commented Oct 24, 2021

Hi, huy,
I come up with an issue while using the library.

  1. I installed it with npm npm i squarify,
  2. I make an index.js file where i import the module import squarify from 'squarify';
    (if I import the module not as a default, ie. import { squarify } from 'squarify' the error is:
    const x0 = rect.x0;
    ^
    TypeError: Cannot read property 'x0' of undefined
    at rectToContainer (C:\Users\Asus\Desktop\test-square\node_modules\squarify\lib\index.js:98:19)
    at getShortestEdge (C:\Users\Asus\Desktop\test-square\node_modules\squarify\lib\index.js:111:21)
    at squarify (C:\Users\Asus\Desktop\test-square\node_modules\squarify\lib\index.js:218:19)
    at file:///C:/Users/Asus/Desktop/test-square/index.js:53:13
    at ModuleJob.run (internal/modules/esm/module_job.js:152:23)
    at async Loader.import (internal/modules/esm/loader.js:166:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5)
  3. and then I copy/paste the container, the array and the function invocation

and what i get is this:

C:\Users\Asus\Desktop\test-square>node index.js
file:///C:/Users/Asus/Desktop/test-square/index.js:26
const output = squarify(data, container);
^
ReferenceError: squarify is not defined
at file:///C:/Users/Asus/Desktop/test-square/index.js:26:16
←[90m at ModuleJob.run (internal/modules/esm/module_job.js:152:23)←[39m
←[90m at async Loader.import (internal/modules/esm/loader.js:166:24)←[39m
←[90m at async Object.loadESM (internal/process/esm_loader.js:68:5)←[39m

Am i doing something wrong?
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant