Take object & prepare as URL params - Node.js Network

Node.js examples for Network:URL

Description

Take object & prepare as URL params

Demo Code

/*/*from ww  w  .j a  v a2s. com*/
 * Take object & prepare as URL params
 * @param {obj} obj
 * @returns {String}
 */
Object.param = function(obj){

  var str = '';
  for (var o in obj){
    if(obj.hasOwnProperty(o))
      str += o + '=' + obj[o] + '&';
  }
  return str;

};

Related Tutorials