You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					31 lines
				
				610 B
			
		
		
			
		
	
	
					31 lines
				
				610 B
			| 
											3 years ago
										 | import { normalizeArguments } from './parsePhoneNumber.js' | ||
|  | import PhoneNumberMatcher from './PhoneNumberMatcher.js' | ||
|  | 
 | ||
|  | /** | ||
|  |  * @return ES6 `for ... of` iterator. | ||
|  |  */ | ||
|  | export default function searchNumbers() | ||
|  | { | ||
|  | 	const { text, options, metadata } = normalizeArguments(arguments) | ||
|  | 
 | ||
|  | 	const matcher = new PhoneNumberMatcher(text, options, metadata) | ||
|  | 
 | ||
|  | 	return  { | ||
|  | 		[Symbol.iterator]() { | ||
|  | 			return { | ||
|  | 	    		next: () => { | ||
|  | 	    			if (matcher.hasNext()) { | ||
|  | 						return { | ||
|  | 							done: false, | ||
|  | 							value: matcher.next() | ||
|  | 						} | ||
|  | 					} | ||
|  | 					return { | ||
|  | 						done: true | ||
|  | 					} | ||
|  | 	    		} | ||
|  | 			} | ||
|  | 		} | ||
|  | 	} | ||
|  | } |