mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 09:56:44 +00:00 
			
		
		
		
	 154fc28a57
			
		
	
	
		154fc28a57
		
	
	
	
	
		
			
			As a result of taking a look on PR #1967 I realized there is 819 executable files in this repository. It is obvious this is an error.
		
			
				
	
	
		
			32 lines
		
	
	
		
			609 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			609 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 'use strict';
 | |
| 
 | |
| /**
 | |
|  * Module dependencies
 | |
|  */
 | |
| 
 | |
| // Public node modules.
 | |
| const _ = require('lodash');
 | |
| 
 | |
| /**
 | |
|  * Detect HTTP verb in an expression.
 | |
|  *
 | |
|  * @api private
 | |
|  */
 | |
| 
 | |
| exports.detectRoute = endpoint => {
 | |
|   const verbExpr = /^(all|get|post|put|delete|trace|options|connect|patch|head|redirect)\s+/i;
 | |
|   let verb = _.last(endpoint.match(verbExpr) || []) || '';
 | |
|   verb = verb.toLowerCase();
 | |
| 
 | |
|   // If a verb was specified, eliminate the verb from the original string.
 | |
|   if (verb) {
 | |
|     endpoint = endpoint.replace(verbExpr, '');
 | |
|   }
 | |
| 
 | |
|   // Return the verb and the endpoint.
 | |
|   return {
 | |
|     verb,
 | |
|     endpoint
 | |
|   };
 | |
| };
 |