Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/lru-cache/README.md')
-rw-r--r--node_modules/lru-cache/README.md8
1 files changed, 7 insertions, 1 deletions
diff --git a/node_modules/lru-cache/README.md b/node_modules/lru-cache/README.md
index f646c1cb8..d660dd574 100644
--- a/node_modules/lru-cache/README.md
+++ b/node_modules/lru-cache/README.md
@@ -25,10 +25,16 @@ cache.set("key", "value")
cache.get("key") // "value"
// non-string keys ARE fully supported
-var someObject = {}
+// but note that it must be THE SAME object, not
+// just a JSON-equivalent object.
+var someObject = { a: 1 }
cache.set(someObject, 'a value')
+// Object keys are not toString()-ed
cache.set('[object Object]', 'a different value')
assert.equal(cache.get(someObject), 'a value')
+// A similar object with same keys/values won't work,
+// because it's a different object identity
+assert.equal(cache.get({ a: 1 }), undefined)
cache.reset() // empty the cache
```