UNPKG

490 BJavaScriptView Raw
1var each = require('./each')
2
3function helperCreateGetObjects (name, getIndex) {
4 var proMethod = Object[name]
5 return function (obj) {
6 var result = []
7 if (obj) {
8 if (proMethod) {
9 return proMethod(obj)
10 }
11 each(obj, getIndex > 1 ? function (key) {
12 result.push(['' + key, obj[key]])
13 } : function () {
14 result.push(arguments[getIndex])
15 })
16 }
17 return result
18 }
19}
20
21module.exports = helperCreateGetObjects