javascriptcanjs

How can I add a property with a dot in the name to an existing CanJS can.Map?


Say I have an existing can.Map called someMap and I need to add a new property named some.data that will contain a string.

In vanilla JS, you can do someMap["some.data"] = "someString" \\ Object {some.data: "someString"}

There doesn't seem to be a way to do this with a can.Map unless I do something like extract the someMap.attr() and store that in a var, then add the property to that var like above, then do someMap.attr(someObjVar), but this fires no change event which is needed here.

Is there a way to do this? Renaming the property is not an option :(

Thanks!


Solution

  • You can't. URL encode it then decode it on the way out.