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.
15 lines
497 B
15 lines
497 B
var isFn = require('./isFn'); |
|
var isObj = require('./isObj'); |
|
var isArr = require('./isArr'); |
|
var optimizeCb = require('./optimizeCb'); |
|
var matcher = require('./matcher'); |
|
var identity = require('./identity'); |
|
var property = require('./property'); |
|
exports = function(val, ctx, argCount) { |
|
if (val == null) return identity; |
|
if (isFn(val)) return optimizeCb(val, ctx, argCount); |
|
if (isObj(val) && !isArr(val)) return matcher(val); |
|
return property(val); |
|
}; |
|
|
|
module.exports = exports;
|
|
|