propertyOf.js 288 B

123456789101112
  1. var noop = require('./noop.js');
  2. var get = require('./get.js');
  3. // Generates a function for a given object that returns a given property.
  4. function propertyOf(obj) {
  5. if (obj == null) return noop;
  6. return function(path) {
  7. return get(obj, path);
  8. };
  9. }
  10. module.exports = propertyOf;