Okay, I've stumbled upon this weird error. I'm using cradle CouchDB connector and when I pass in k (typeof -> string) it works but when I uncomment the line k = k.toLowerCase(); it gives me the error below the code below.
Code:
JSON.parse(fs.readFileSync('dictionary/dictionary.json', 'utf8'), function(k, l){
//k = k.toLowerCase();
db.save(k, {
definition: l
}, function(err, res) {
console.log('Error: ' + err);
console.log(res);
});
entry++;
});
Error:
/usr/local/nginx/html/whois.dev/node_modules/cradle/lib/cradle/cache.js:37
if (entry.document.toJSON) {
^
TypeError: Cannot read property 'toJSON' of undefined