mirror of https://github.com/zulip/zulip.git
dict: Make set() return the value passed
We were accidentally leaking our internal representation. (imported from commit 08ddc42583fb13a2ad51eea7ed1b30bf5ccb4645)
This commit is contained in:
parent
707898b236
commit
62aec87962
|
@ -57,7 +57,8 @@ Dict.prototype = _.object(_.map({
|
|||
},
|
||||
|
||||
set: function Dict_set(key, value) {
|
||||
return (this._items[this._munge(key)] = {k: key, v: value});
|
||||
this._items[this._munge(key)] = {k: key, v: value};
|
||||
return value;
|
||||
},
|
||||
|
||||
has: function Dict_has(key) {
|
||||
|
|
|
@ -31,6 +31,10 @@ var _ = global._;
|
|||
assert.strictEqual(d.get('bar'), undefined);
|
||||
|
||||
assert.deepEqual(d.keys(), ['foo']);
|
||||
|
||||
var val = ['foo'];
|
||||
var res = d.set('abc', val);
|
||||
assert.equal(val, res);
|
||||
}());
|
||||
|
||||
(function test_restricted_keys() {
|
||||
|
|
Loading…
Reference in New Issue