🎉 initiate project *astro_rewrite*
This commit is contained in:
		
							parent
							
								
									ffd4d5e86c
								
							
						
					
					
						commit
						2ba37bfbe3
					
				
					 8658 changed files with 2268794 additions and 2538 deletions
				
			
		
							
								
								
									
										42
									
								
								node_modules/vscode-html-languageservice/lib/esm/utils/arrays.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								node_modules/vscode-html-languageservice/lib/esm/utils/arrays.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,42 @@ | |||
| /*--------------------------------------------------------------------------------------------- | ||||
|  *  Copyright (c) Microsoft Corporation. All rights reserved. | ||||
|  *  Licensed under the MIT License. See License.txt in the project root for license information. | ||||
|  *--------------------------------------------------------------------------------------------*/ | ||||
| /** | ||||
|  * Takes a sorted array and a function p. The array is sorted in such a way that all elements where p(x) is false | ||||
|  * are located before all elements where p(x) is true. | ||||
|  * @returns the least x for which p(x) is true or array.length if no element fullfills the given function. | ||||
|  */ | ||||
| export function findFirst(array, p) { | ||||
|     let low = 0, high = array.length; | ||||
|     if (high === 0) { | ||||
|         return 0; // no children
 | ||||
|     } | ||||
|     while (low < high) { | ||||
|         let mid = Math.floor((low + high) / 2); | ||||
|         if (p(array[mid])) { | ||||
|             high = mid; | ||||
|         } | ||||
|         else { | ||||
|             low = mid + 1; | ||||
|         } | ||||
|     } | ||||
|     return low; | ||||
| } | ||||
| export function binarySearch(array, key, comparator) { | ||||
|     let low = 0, high = array.length - 1; | ||||
|     while (low <= high) { | ||||
|         const mid = ((low + high) / 2) | 0; | ||||
|         const comp = comparator(array[mid], key); | ||||
|         if (comp < 0) { | ||||
|             low = mid + 1; | ||||
|         } | ||||
|         else if (comp > 0) { | ||||
|             high = mid - 1; | ||||
|         } | ||||
|         else { | ||||
|             return mid; | ||||
|         } | ||||
|     } | ||||
|     return -(low + 1); | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 sindrekjelsrud
						sindrekjelsrud