MCPcopy Create free account
hub / github.com/circircir-circle/human_exist_device / paramSerializer

Method paramSerializer

mini_program/common/Tools.js:567–584  ·  view source on GitHub ↗

* 对象序列化 * @param {Object} obj * @return {String}

(obj)

Source from the content-addressed store, hash-verified

565 * @return {String}
566 */
567 paramSerializer(obj) {
568 if (!obj) return ''
569 let that = this
570 let parts = []
571 for (let key in obj) {
572 //if(key=='url')continue;
573 const value = obj[key]
574 if (value === null || that.isUndefined(value)) return
575 if (that.isArray(value)) {
576 value.forEach(function(v) {
577 parts.push(that.encodeUriQuery(key) + '=' + that.encodeUriQuery(that.serializeValue(v)))
578 })
579 } else {
580 parts.push(that.encodeUriQuery(key) + '=' + that.encodeUriQuery(that.serializeValue(value)))
581 }
582 }
583 return parts.join('&')
584 }
585
586 /**
587 * 拼接URL

Callers 1

buildUrlMethod · 0.95

Calls 4

isUndefinedMethod · 0.80
isArrayMethod · 0.80
encodeUriQueryMethod · 0.80
serializeValueMethod · 0.80

Tested by

no test coverage detected