use lastIndexOf
This commit is contained in:
		
							parent
							
								
									a7ebc7ce86
								
							
						
					
					
						commit
						76fee917ea
					
				@ -199,7 +199,7 @@ cli.main(function (args, cli) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    packet.question.forEach(function (q) {
 | 
			
		||||
      // if (-1 === q.name.indexOf(cli.casedQuery))
 | 
			
		||||
      // if (-1 === q.name.lastIndexOf(cli.casedQuery))
 | 
			
		||||
      if (q.name !== cli.casedQuery) {
 | 
			
		||||
        fail0x20 = q.name;
 | 
			
		||||
      }
 | 
			
		||||
@ -209,8 +209,8 @@ cli.main(function (args, cli) {
 | 
			
		||||
      [ 'question', 'answer', 'authority', 'additional' ].forEach(function (group) {
 | 
			
		||||
        (packet[group]||[]).forEach(function (a) {
 | 
			
		||||
          var an = a.name;
 | 
			
		||||
          var i = cli.query.toLowerCase().indexOf(a.name.toLowerCase());  // answer is something like ExAMPle.cOM and query was wWw.ExAMPle.cOM
 | 
			
		||||
          var j = a.name.toLowerCase().indexOf(cli.query.toLowerCase());  // answer is something like www.ExAMPle.cOM and query was ExAMPle.cOM
 | 
			
		||||
          var i = cli.query.toLowerCase().lastIndexOf(a.name.toLowerCase());  // answer is something like ExAMPle.cOM and query was wWw.ExAMPle.cOM
 | 
			
		||||
          var j = a.name.toLowerCase().lastIndexOf(cli.query.toLowerCase());  // answer is something like www.ExAMPle.cOM and query was ExAMPle.cOM
 | 
			
		||||
 | 
			
		||||
          // it's important to note that these should only relpace changes in casing that we expected
 | 
			
		||||
          // any abnormalities should be left intact to go "huh?" about
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user