1
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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
|
||||
Reference in New Issue
Block a user