title: converting object properties which are array like to array is not working
body: <p>I have an nested object like following(it can have any depth):</p>
  
  <pre><code>{
      "a": 5,
      "b": {
          "0": 1,
          "1": "x"
      },
      "x": {
          "a": 1,
          "1": "z"
      },
      "c": {
          "0": 3,
          "1": "Am",
          "3":{
              "0": 3,
              "1": "x",
              "2":{
                  "0": 3,
                  "1": "Y"
              },
              "length": 3
          },
          "length": 4
      }
  }
  </code></pre>
  
  <p>I have to convert it as following(object may or may not have length property):</p>
  
  <pre><code>{
      "a": 5,
      "x": {
          "a": 1,
          "1": "z"
      },
      "b": [1,"x"],
      "c": [3, "Am",undefind, [ 3, "x", [ 3, "Y" ] ] ]
  }
  </code></pre>
  
  <p>I written method like following:</p>
  
  <pre><code>function formatObjToArr(obj) {
      var kys = Object.keys(obj);
      var isObj = (/[^0-9]/g).test(kys.join('')) &amp;&amp; !Array.isArray(obj);
      if(!isObj){
          obj.length===undefined &amp;&amp; (obj.length = Math.max.apply(null,kys.map(function (i) { return parseInt(i) }))+1);
          obj = Array.prototype.map.apply(obj,[function (i) { return i}]);
          obj.forEach(function (i) {
              (typeof i === "object" &amp;&amp; i!==null) &amp;&amp; formetObjToArr(i);
          })
      }else {
          for (var property in obj) {
              if (obj.hasOwnProperty(property) &amp;&amp; property!=='length') {
                  if (typeof obj[property] === "object" &amp;&amp; obj[property]!==null) {
                      formetObjToArr(obj[property]);
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>But it just adds the length property it is not changing the type. output of my code is as follows:</p>
  
  <pre><code>{
    "a": 5,
    "b": {
        "0": 1,
        "1": "x",
        "length": 2
     },
    "x": {
        "a": 1,
        "1": "z"
    },
    "c": {
        "0": 3,
        "1": "Am",
        "3": {
            "0": 3,
            "1": "x",
            "2": {
                "0": 3,
                "1": "Y",
                "length": 2
            },
            "length": 3
        },
        "length": 4
    }
  }
  </code></pre>