deleteKeyValue
Delete a named property from a MapLike object.
deleteKeyValue(obj, key)
Remove the property identified by the String or Symbol key
from the Map-like object obj
, if possible.
Property definitions may interfere with deleting key values; the behavior on obj
if obj[key]
cannot
be deleted is undefined. The default use of the native delete
keyword can be overridden by obj
if it
implements @@can.deleteKeyValue.
var foo = new DefineMap({ bar: "baz" });
var quux = new CanMap({ thud: "jeek" });
canReflect.deleteKeyValue(foo, "bar");
canReflect.deleteKeyValue(quux, "thud");
"bar" in foo; // -> true -- DefineMaps use property defs which cannot be un-defined
foo.bar // -> undefined -- but set values to undefined when deleting
"thud" in quux; // -> false
quux.thud; // -> undefined
Parameters
- obj
{Object}
:the object to delete on
- key
{String}
:the key for the property to delete