xe-utils
Version:
JavaScript 函数库、工具类
22 lines (20 loc) • 511 B
JavaScript
import each from './each.js';function helperCreateGetObjects (name, getIndex) {
var proMethod = Object[name]
return function (obj) {
var result = []
if (obj) {
if (proMethod) {
return proMethod(obj)
}
each(obj, getIndex > 1
? function (key) {
result.push(['' + key, obj[key]])
}
: function () {
result.push(arguments[getIndex])
})
}
return result
}
}
export default helperCreateGetObjects