bundle/js/convertMapTo.js
function toNested(map) {

  var split, first, last;
  utils.walkObject(map, function (val, prop1) {

    split = prop1.split('.');

    if (!utils.validateFieldName(prop1)) {
      log.error('map field name "' + prop1 + '" is invalid');
    }

    last = split[split.length - 1];
    first = prop1.replace('.' + last, '');

    utils.walkObject(map, function (val2, prop2) {
      if (prop1 !== prop2 && first === prop2) {
        log.error('map field name "' + prop2 + '" is invalid');
      }
    });
  });

  var form = {};
  var names = [];

  utils.walkObject(map, function (val, prop) {
    names.push({ keys: prop.split('.'), value: val });
  });

  var obj;
  names.forEach(function (name) {
    obj = form;
    name.keys.forEach(function (key, index) {
      if (index === name.keys.length - 1) {
        obj[key] = name.value;
      } else {
        if (!obj[key]) {
          obj[key] = {};
        }
        obj = obj[key];
      }
    });
  });

  return form;
}
function toNested(map) {

  var split, first, last;
  utils.walkObject(map, function (val, prop1) {

    split = prop1.split('.');

    if (!utils.validateFieldName(prop1)) {
      log.error('map field name "' + prop1 + '" is invalid');
    }

    last = split[split.length - 1];
    first = prop1.replace('.' + last, '');

    utils.walkObject(map, function (val2, prop2) {
      if (prop1 !== prop2 && first === prop2) {
        log.error('map field name "' + prop2 + '" is invalid');
      }
    });
  });

  var form = {};
  var names = [];

  utils.walkObject(map, function (val, prop) {
    names.push({ keys: prop.split('.'), value: val });
  });

  var obj;
  names.forEach(function (name) {
    obj = form;
    name.keys.forEach(function (key, index) {
      if (index === name.keys.length - 1) {
        obj[key] = name.value;
      } else {
        if (!obj[key]) {
          obj[key] = {};
        }
        obj = obj[key];
      }
    });
  });

  return form;
}
function toNested ( map ) { var split , first , last ; utils . walkObject ( map , function ( val , prop1 ) { split = prop1 . split ( '.' ) ; if ( ! utils . validateFieldName ( prop1 ) ) { log . error ( 'map field name "' + prop1 + '" is invalid' ) ; } last = split [ split . length - 1 ] ; first = prop1 . replace ( '.' + last , '' ) ; utils . walkObject ( map , function ( val2 , prop2 ) { if ( prop1 !== prop2 && first === prop2 ) { log . error ( 'map field name "' + prop2 + '" is invalid' ) ; } } ) ; } ) ; var form = { } ; var names = [ ] ; utils . walkObject ( map , function ( val , prop ) { names . push ( { keys : prop . split ( '.' ) , value : val } ) ; } ) ; var obj ; names . forEach ( function ( name ) { obj = form ; name . keys . forEach ( function ( key , index ) { if ( index === name . keys . length - 1 ) { obj [ key ] = name . value ; } else { if ( ! obj [ key ] ) { obj [ key ] = { } ; } obj = obj [ key ] ; } } ) ; } ) ; return form ; }
Plain to nested.
Plain to nested .