summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js/core')
-rw-r--r--addons/web/static/src/js/core/utils.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/web/static/src/js/core/utils.js b/addons/web/static/src/js/core/utils.js
index ac9310dce90..3fc88ac5b20 100644
--- a/addons/web/static/src/js/core/utils.js
+++ b/addons/web/static/src/js/core/utils.js
@@ -458,6 +458,20 @@ var utils = {
}
},
/**
+ * Enhanced traverse function with 'path' building on traverse.
+ *
+ * @param {Object} tree an object describing a tree structure
+ * @param {function} f a callback
+ * @param {Object} path the path to the current 'tree' object
+ */
+ traversePath: function (tree, f, path) {
+ path = path || [];
+ f(tree, path);
+ _.each(tree.children, function (node) {
+ utils.traversePath(node, f, path.concat(tree));
+ });
+ },
+ /**
* Visit a tree of objects and freeze all
*
* @param {Object} obj