set
Sets multiple properties on a map instance or a property that wasn't predefined.
map.set(propName, value)
Assigns value to a property on this map instance called propName. This will define the property if it hasn't already been predefined.
import {DefineMap} from "can";
const map = new DefineMap({});
map.set("propA", "value");
console.log( map.serialize() ); //-> {propA: "value"}
Predefined properties can always set the property directly: map.propName = value.
Parameters
- propName
{String}:The property to set.
- value
{*}:The value to assign to
propName.
map.set(props [,removeProps])
Assigns each value in props to a property on this map instance named after the
corresponding key in props, effectively merging props into the Map. If removeProps is true, properties not in
props will be set to undefined.
Parameters
- props
{Object}:A collection of key-value pairs to set. If any properties already exist on the map, they will be overwritten.
- removeProps
{Boolean}:Whether to set keys not present in
propstoundefined.