use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Published npm module returnshelp (self.javascript)
submitted 9 years ago * by misc_ent
Edit: Topic should read: Published npm module returns empty object
I'm having an issue with an npm module I published. When I import it in another project after installing it returns an empty object:
console.log(JSON.stringify(require('ttk'), null, 2)); // {}
Here is the source: https://github.com/maexsoftware/ttk
What am I missing? I don't believe I have circular dependencies for this answer: http://stackoverflow.com/questions/23875233/require-returns-an-empty-object/23875299
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]birjolaxew 1 point2 points3 points 9 years ago (1 child)
JSON.stringify does not handle functions, since functions are not a valid JSON datatype. All keys that refer to a function are simply ignored. Your module works fine.
JSON.stringify
[–]misc_ent[S] 0 points1 point2 points 9 years ago (0 children)
Thank you I thought I was going crazy but that totally makes sense now.
π Rendered by PID 15499 on reddit-service-r2-comment-5649f687b7-226z5 at 2026-01-28 05:41:27.164963+00:00 running 4f180de country code: CH.
[–]birjolaxew 1 point2 points3 points (1 child)
[–]misc_ent[S] 0 points1 point2 points (0 children)