I have a model with a function call of util.endsWith(str, end)
but I forgot to import my util file. Normally I would expect an error like:
cannot call method 'endsWith' of undefined
or something like that
but the error I am getting is:
TypeError: Object #<Object> has no method 'endsWith'
which indicates that util
is defined. I did a console.log of it and found that it is the same object you get from require('util')
.
I certainly did not require the util module in this, and I can't find anywhere in my files where I do so (not that I would expect something require-ed in another file to be in this file).
Interestingly, util
is only defined if I require this module from somewhere else; if I just run the file then util
is undefined.
Is this normal?
My files are not that complicated (<100 lines each) but I have not been able to replicate it with a super basic example. Maybe it has to be a couple of levels deep.
nodejs 0.10.12