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.
21 lines
469 B
21 lines
469 B
var each = require('./each')
|
|
|
|
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
|
|
}
|
|
}
|
|
|
|
module.exports = helperCreateGetObjects
|
|
|