You can use an immediately-invoked named function expression:
(function updateIconPathRecorsive(item) {
if (item.iconSrc) {
item.iconSrcFullpath = 'some value..';
}
_.each(item.items, updateIconPathRecorsive);
})(json);
But your snippet is fine as well and will not cause problems in IE.
There is no recursive wrapper function for underscore, and it doesn't provide a Y-combinator either. But if you want, you can easily create one yourself of course:
_.mixin({
recursive: function(obj, opt, iterator) {
function recurse(obj) {
iterator(obj);
_.each(obj[opt.children], recurse);
}
recurse(obj);
}
});