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