This file contains hidden or 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
import React from 'react' | |
import Topbar from './Topbar' | |
import Sidebar from './Sidebar' | |
import About from './About' | |
import Contact from './Contact' | |
import PrivacyPolicy from './PrivacyPolicy' | |
import Dashboard from './Dashboard' | |
import { Router } from '@reach/router' | |
function App() { |
This file contains hidden or 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
function AuthValidator({ token, children, ...rest }) { | |
if (isAuthed(token)) { | |
return children({ authenticated: true }) | |
} | |
return children({ authenticated: false }) | |
} | |
const DeactivatorInput = ({ style, ...rest }) => ( | |
<input | |
{...rest} |
This file contains hidden or 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
function AuthValidator({ token, render, ...rest }) { | |
if (isAuthed(token)) { | |
return render({ authenticated: true }) | |
} | |
return render({ authenticated: false }) | |
} | |
const DeactivatorInput = ({ style, ...rest }) => ( | |
<input | |
{...rest} |
This file contains hidden or 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
import React from 'react' | |
function isAuthed(token) { | |
// some auth logic | |
} | |
const withAuthValidation = (WrappedComponent) => { | |
return (props) => { | |
if (isAuthed(props.token)) { | |
return <WrappedComponent {...props} /> |
This file contains hidden or 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
{ | |
"../javascript-algorithms/src/algorithms/math/fourier-transform/__test__": { | |
"name": "fourier-transform", | |
"category": "algorithms", | |
"subcategory": "math", | |
"totalFiles": 1, | |
"filesList": ["FourierTester.js"] | |
}, | |
"../javascript-algorithms/src/algorithms/sets/cartesian-product/__test__": { | |
"name": "cartesian-product", |
This file contains hidden or 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
function createMissingTestsObject(str, dir) { | |
const indexToSrc = str.indexOf('src') | |
let category = str.substring(indexToSrc + 4) | |
let subcategory = category.substring(category.indexOf('/') + 1) | |
subcategory = subcategory.substring(0, subcategory.indexOf('/')) | |
category = category.substring(0, category.indexOf('/')) | |
return { | |
name: str.substring(str.lastIndexOf('/') + 1), | |
category, |
This file contains hidden or 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
function findEmptyTests(basepath) { | |
let emptyTests = {} | |
if (isDirectory(basepath)) { | |
const dir = fs.readdirSync(basepath) | |
for (let index = 0; index < dir.length; index++) { | |
const filename = dir[index] | |
const filepath = `${basepath}/${filename}` | |
This file contains hidden or 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
function hasTest(testDir) { | |
for (let index = 0; index < testDir.length; index++) { | |
const filename = testDir[index] | |
if (filename.endsWith('.test.js')) { | |
return true | |
} | |
} | |
return false | |
} |
This file contains hidden or 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
function isDirectory(filePath) { | |
return fs.statSync(filePath).isDirectory() | |
} |
This file contains hidden or 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
import fs from 'fs' | |
const rootDir = '../javascript-algorithms/src' |