jsonUtils.js
658 Bytes
var $ = require('jquery');
var jsonUtils={
formSerializeArrayKey:{
name:"name",
value:"value"
} ,
toJsonObj:function(_params){
var _g=this;
var result={};
var one_form_data= _params.data;
var _value;
for(var key in one_form_data){
_value=one_form_data[key][_g.formSerializeArrayKey.value];
if(typeof(_value)==="string"){
_value=$.trim(_value);
}
result[one_form_data[key][_g.formSerializeArrayKey.name]]=_value;
}
return result;
},
};
module.exports = jsonUtils;