是否存在允许逻辑相等与引用相等的唯一对象键的映射数据结构?

时间:2015-11-18 18:29:48

标签: javascript dictionary data-structures

我正在寻找有关数据结构的任何信息,这些信息将允许我执行以下操作。

// I assume a data structure like this would be called DeepMap
var map = new DeepMap();

// The key is a deep JS object
map.set({this: {is: 'a key'}}, 'value');

// Notice that we retrieve the value using a key that is not equal to the
// original key by reference. However, it is logically equal.
map.get({this: {is: 'a key'}) === 'value'; // true

一个警告:它不能简单地散列对象的整个内容以将其转换为字符串键。

正确方向的任何指针?我正在用JS编程,但不一定要寻找JS特定的答案。谢谢!

0 个答案:

没有答案