fix(resource): more reliable obj.forEach check