Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _src/lib/node_cache.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ module.exports = class NodeCache extends EventEmitter
# if the data is a Promise, use defined default
# (can't calculate actual/resolved value size synchronously)
@options.promiseValueSize
else if typeof value is "object"
else if value? and typeof value is "object"
# if the data is an Object multiply each element with a defined default length
@options.objectValueSize * Object.keys( value ).length
else if typeof value is "boolean"
Expand Down
20 changes: 20 additions & 0 deletions _src/test/mocha_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1143,4 +1143,24 @@ describe "`#{pkg.name}@#{pkg.version}` on `node@#{process.version}`", () ->

return

describe "Issues", () ->
describe("#151 - cannot set null", () ->
cache = null
before(() ->
cache = new nodeCache()
return
)

it("set the value `null` - this should not throw or otherwise fail", () ->
cache.set("test", null)
return
)

it("should also return `null`", () ->
should(cache.get("test")).be.null()
return
)
return
)
return
return