123456789101112131415161718192021 |
- 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
|