00001 var apply = require('./_apply'), 00002 castPath = require('./_castPath'), 00003 last = require('./last'), 00004 parent = require('./_parent'), 00005 toKey = require('./_toKey'); 00006 00017 function baseInvoke(object, path, args) { 00018 path = castPath(path, object); 00019 object = parent(object, path); 00020 var func = object == null ? object : object[toKey(last(path))]; 00021 return func == null ? undefined : apply(func, object, args); 00022 } 00023 00024 module.exports = baseInvoke;