Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

property.js 466B

12345678910111213141516
  1. define(['./isArray', './_shallowProperty', './_deepGet'], function (isArray, _shallowProperty, _deepGet) {
  2. // Creates a function that, when passed an object, will traverse that object’s
  3. // properties down the given `path`, specified as an array of keys or indices.
  4. function property(path) {
  5. if (!isArray(path)) {
  6. return _shallowProperty(path);
  7. }
  8. return function(obj) {
  9. return _deepGet(obj, path);
  10. };
  11. }
  12. return property;
  13. });