Limit number of returned codepoints
This commit is contained in:
		
							parent
							
								
									fde68ee833
								
							
						
					
					
						commit
						57173d14dd
					
				@ -128,7 +128,14 @@ newtype CodepointsModel = CodepointsModel
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mkCodepointsModel :: [(Word, Word)] -> CodepointsModel
 | 
					mkCodepointsModel :: [(Word, Word)] -> CodepointsModel
 | 
				
			||||||
mkCodepointsModel = CodepointsModel . map go . concatMap (uncurry enumFromTo)
 | 
					mkCodepointsModel =
 | 
				
			||||||
 | 
					  CodepointsModel
 | 
				
			||||||
 | 
					  -- Limit number of returned codepoints. Otherwise it's
 | 
				
			||||||
 | 
					  -- too easy to provoke massive response bodies with requests like
 | 
				
			||||||
 | 
					  -- /codepoints/0-99999999
 | 
				
			||||||
 | 
					  . take 100000
 | 
				
			||||||
 | 
					  . map go
 | 
				
			||||||
 | 
					  . concatMap (uncurry enumFromTo)
 | 
				
			||||||
  where
 | 
					  where
 | 
				
			||||||
    go codepoint = (codepoint, toChar codepoint)
 | 
					    go codepoint = (codepoint, toChar codepoint)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user