You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
402 B
20 lines
402 B
var values = require('./values')
|
|
var each = require('./each')
|
|
|
|
/**
|
|
* 根据键数组、值数组对转换为对象
|
|
*
|
|
* @param {Array} props 键数组
|
|
* @param {Number} arr 值数组
|
|
* @return {Object}
|
|
*/
|
|
function zipObject (props, arr) {
|
|
var result = {}
|
|
arr = arr || []
|
|
each(values(props), function (val, key) {
|
|
result[val] = arr[key]
|
|
})
|
|
return result
|
|
}
|
|
|
|
module.exports = zipObject
|
|
|