This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// source: | |
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods | |
const httpMethods = { | |
CONNECT: 'CCONNECT', // The CONNECT method establishes a tunnel to the server identified by the target resource | |
DELETE: 'DELETE', // The DELETE method deletes the specified resource | |
GET: 'GET', // The GET method requests a representation of the specified resource. Requests using GET should only retrieve data | |
HEAD: 'HEAD', // The HEAD method asks for a response identical to that of a GET request, but without the response body | |
OPTIONS: 'OPTIONS', // The OPTIONS method is used to describe the communication options for the target resource | |
PATCH: 'PATCH', // The PATCH method is used to apply partial modifications to a resource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//flattens an array of arbitrarily nested arrays without the use of Array.prototype.reduce | |
//i.e. [1,[2,[3,4]]] => [1,2,3,4] | |
//returns -1 if input is not an array | |
function flatten(arr) { | |
if(!Array.isArray(arr)) { | |
return -1; | |
} | |
let flat = []; | |
for(let i = 0; i < arr.length; i++) { |