mapToJSObjForDeep function

Object mapToJSObjForDeep(
  1. Map map
)

Implementation

Object mapToJSObjForDeep(Map<dynamic, dynamic> map) {
  Object object = js.newObject();
  map.forEach((k, v) {
    var key = k;
    var value = v;

    if (v is List) {
      value = (v.map((e) => mapToJSObjForDeep(e))).toList();
    }
    if (v is Map) {
      value = mapToJSObjForDeep(v);
    }
    js.setProperty(object, key, value);
  });

  return object;
}