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
const flattenArr = (arr = []) => { | |
// Executing recursively a reducer function seems the logical choice, since it will result... | |
// ...in a single output value | |
return arr.reduce((accumulator, currentValue) => { | |
return accumulator.concat(Array.isArray(currentValue) ? flattenArr(currentValue) : currentValue); | |
}, []); | |
}; | |
// Using Jest for testing | |
test('[[1,2,[3]],4] -> [1,2,3,4]', () => { |
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
{ | |
"extends": "airbnb", | |
"parser": "babel-eslint", | |
"env": { | |
"node": true, | |
"es6": true, | |
"mocha": true | |
}, | |
"rules": { | |
// indentation |
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
/** | |
* Created by Phil on 02/23/17. | |
*/ | |
// BASE SETUP | |
// ================================================================================================ | |
// Imports | |
const express = require('express'); | |
const app = express(); | |
const bodyParser = require('body-parser'); | |
const path = require('path'); |
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
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required |