mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	js: Convert _.reduce to less convoluted code.
reduce is almost never a better solution than the alternatives. Avoid it. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							050915c46c
						
					
				
				
					commit
					e1cf5e4630
				
			@@ -58,10 +58,8 @@ class MarkdownComparer {
 | 
			
		||||
        if (node1.content.childNodes.length !== node2.content.childNodes.length) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        return _.reduce(
 | 
			
		||||
            _.zip(node1.content.childNodes, node2.content.childNodes),
 | 
			
		||||
            (prev, nodePair) => { return prev && nodePair[0].isEqualNode(nodePair[1]); },
 | 
			
		||||
            true
 | 
			
		||||
        return _.zip(node1.content.childNodes, node2.content.childNodes).every(([child1, child2]) =>
 | 
			
		||||
            child1.isEqualNode(child2)
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user