TypeScript pattern matching 
			 
			
				Install 
			 
			yarn add perfect-matcher
			npm install perfect-matcher
			
				Features 
			 
			
			
				Docs 
			 
			z81.github.io/matcher 
			
				Example 
			 
			console .log(
  match(7 )(
    value('str' , v  =>console .log(`This is string "${v} "` )),
    value(7 , v  =>console .log('This is number 7' ) && 'return this' ),
    value({ a: '2'  }, v  =>console .log("This is {a: '2'}" , v)),
    value({ a: '3'  }, v  =>console .log("This is {a: '3'}" )),
    value(null , v  =>console .log('This is null' )),
    value(false , v  =>console .log('This is false' )),
    type (0 , ()  =>console .log('This is number' )),
    string (()  =>console .log('This is string' )),
    boolean (()  =>console .log('This is boolean' )),
    regexp(()  =>console .log('This is RegExp' )),
    nan(()  =>console .log('This is NaN' )),
    array(()  =>console .log('This is array' )),
    instance(Store, ()  =>console .log('This is Store' ))
  )
)console .log(
  match(['firstName' ] as  [string , string ?])(
    tuple((firstName, lastName ) =>  `${firstName}  ${lastName} ` ),
    tuple(firstName  =>`${firstName} ` )
  )
  
)
		 
		
		
			Type aliases 
			
				Matcher 
				Matcher<T>:  [ function ,  MatcherClb < T > ] 
				
				Type parameters 
				
			 
		 
		
			Functions 
			
				Const  any
					any<T>( clb:  MatcherClb < T > ) :  Matcher < T >  
				 
				
					
						
						Type parameters 
						
						Parameters 
						
						
					 
				 
			 
			
				Const  array
					array( clb:  MatcherClb < Array < any > > ) :  Matcher < Array < any > >  
				 
				
					
						
						Parameters 
						
							
								clb: MatcherClb < Array < any > >  
							 
						 
						Returns Matcher < Array < any > >  
					 
				 
			 
			
				Const  boolean
					boolean( clb:  MatcherClb < boolean > ) :  [ function ,  function ]  
				 
				
					
						
						Parameters 
						
						Returns [ function ,  function ]  
					 
				 
			 
			
				Const  instance
					instance<T>( value:  T , clb:  MatcherClb < T > ) :  Matcher < T >  
				 
				
					
						
						Type parameters 
						
						Parameters 
						
							
								value: T  
							 
							
								clb: MatcherClb < T >  
							 
						 
						
					 
				 
			 
			
				Const  match
					match<T>( value:  T ) :  (Anonymous function)  
				 
				
					
						
						Type parameters 
						
						Parameters 
						
						Returns (Anonymous function)  
					 
				 
			 
			
				Const  matchAll 
					matchAll<T>( value:  T ) :  (Anonymous function)   
				 
				
					
						
						Type parameters 
						
						Parameters 
						
						Returns (Anonymous function)  
					 
				 
			 
			
				Const  nan
					nan( clb:  MatcherClb < number > ) :  Matcher < number >  
				 
				
			 
			
				Const  negative
					negative( clb:  MatcherClb < number > ) :  Matcher < number >  
				 
				
			 
			
				Const  number
					number( clb:  MatcherClb < number > ) :  [ function ,  function ]  
				 
				
					
						
						Parameters 
						
						Returns [ function ,  function ]  
					 
				 
			 
			
				Const  object
					object( clb:  MatcherClb < object > ) :  [ function ,  function ]  
				 
				
					
						
						Parameters 
						
						Returns [ function ,  function ]  
					 
				 
			 
			
				Const  positive
					positive( clb:  MatcherClb < number > ) :  Matcher < number >  
				 
				
			 
			
				Const  regexp
					regexp( clb:  MatcherClb < RegExp > ) :  Matcher < RegExp >  
				 
				
			 
			
				Const  string
					string( clb:  MatcherClb < string > ) :  [ function ,  function ]  
				 
				
					
						
						Parameters 
						
						Returns [ function ,  function ]  
					 
				 
			 
			
				Const  tuple
					tuple<T>( clb:  function ) :  Matcher < T >  
				 
				
					
						
						Type parameters 
						
						Parameters 
						
							
								clb: function  
								
									
										
											( ... args:  Partial < T > ) :  any  
										
									 
								 
							 
						 
						
					 
				 
			 
			
				Const  type
					type<T>( value:  T , clb:  MatcherClb < T > ) :  Matcher < T >  
				 
				
					
						
						Type parameters 
						
						Parameters 
						
							
								value: T  
							 
							
								clb: MatcherClb < T >  
							 
						 
						
					 
				 
			 
			
				Const  value
					value<T>( value:  T , clb:  MatcherClb < T > ) :  Matcher < T >  
				 
				
					
						
						Type parameters 
						
						Parameters 
						
							
								value: T  
							 
							
								clb: MatcherClb < T >  
							 
						 
						
					 
				 
			 
		 
		
			
				Legend 
				
					
						Module Object literal Variable Function Function with type parameter Index signature Type alias Type alias with type parameter  
					
						Enumeration Enumeration member Property Method  
					
						Interface Interface with type parameter Constructor Property Method Index signature  
					
						Class Class with type parameter Constructor Property Method Accessor Index signature  
					
						Inherited constructor Inherited property Inherited method Inherited accessor  
					
						Protected property Protected method Protected accessor  
					
						Private property Private method Private accessor  
					
						Static property Static method