can-symbol
Version:
Well known symbols used to detail how to operate on different objects
25 lines (18 loc) • 809 B
Markdown
String, *)} can-symbol/symbols/setKeyValue can.setKeyValue
can-symbol/symbols/get-set
Defines a function that sets the value of one of an object's named properties.
`@ .setKeyValue( key, value )`
The `@@@ .setKeyValue` symbol points to a Map-like object's property mutator function, which updates the value of the
object's property with the supplied key. This is only applicable to objects where keyed properties are relevant (like maps).
```
var map = {
set: function (key, value) {
Observation.add(this, key);
this[key] = value;
}
}
map[canSymbol.for('can.setKeyValue')] = map.set;
```
{Object} an object with named properties
{String} key the key to set on the object
{*} key the property value to set on the object
{function(