Requires

Provides

Object.Extras.js

Extra Object generics, like getFromPath which allows a path notation to child elements.

License:
MIT-style license
Authors:
Aaron Newton
  1. 25
  2. 26
  3. 27
  4. 28
  5. 29
  6. 30
  7. 31
  8. 32
  9. 33
  10. 34
  11. 35
  12. 36
  13. 37
  14. 38
  15. 39
  16. 40
  17. 41
  18. 42
  19. 43
  20. 44
  21. 45
  22. 46
  23. 47
  24. 48
  25. 49
  26. 50
  27. 51
  28. 52
  29. 53
  30. 54
  31. 55
  32. 56
  33. 57
  34. 58
  35. 59
  36. 60
Object.extend({ getFromPath: function(source, key){ var parts = key.split('.'); for (var i = 0, l = parts.length; i < l; i++){ if (source.hasOwnProperty(parts[i])) source = source[parts[i]]; else return null; } return source; }, cleanValues: function(object, method){ method = method || function(obj){ return obj != null; }; for (key in object){ if (!method(object[key])) delete object[key]; } return object; }, erase: function(object, key){ if (object.hasOwnProperty(key)) delete object[key]; return object; }, run: function(object){ var args = Array.slice(arguments, 1); for (key in object){ if (typeOf(object[key]) == 'function') object[key].apply(object, args); } } });