getNative.js 456 B

12345678910111213141516
  1. var isNative = require('../lang/isNative');
  2. /**
  3. * Gets the native function at `key` of `object`.
  4. *
  5. * @private
  6. * @param {Object} object The object to query.
  7. * @param {string} key The key of the method to get.
  8. * @returns {*} Returns the function if it's native, else `undefined`.
  9. */
  10. function getNative(object, key) {
  11. var value = object == null ? undefined : object[key];
  12. return isNative(value) ? value : undefined;
  13. }
  14. module.exports = getNative;