正则表达式字面量一个bug(续)
var toCamel = function (json) { var re = /(_\w)/g; var rename = ""; var arr = []; var i = 0; for (var attr in json) { arr[i] = attr; i++; }; for (i = 0; i < arr.length; i++) { var attr = arr[i]; if (typeof json[attr] === "object") { json[attr] = arguments.callee(json[attr]); }; if (arr[i].match(re)) { rename = attr.replace(re, function($0) { return $0.substring(1).toUpperCase(); }); json[rename] = json[attr];