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
<head> | |
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script> | |
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> | |
</head> | |
<body> | |
<div id="root"></div> | |
</body> |
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
//GET STREAMS | |
{ | |
"_links":{ | |
"self":"https://api.twitch.tv/kraken/streams/freecodecamp", | |
"channel":"https://api.twitch.tv/kraken/channels/freecodecamp" | |
}, | |
"stream":null | |
} | |
//GET USERS |
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
function replace(str, before, after) { | |
var aslice = after.slice(1); | |
if(before[0] === before[0].toUpperCase()){ | |
var caps = after.charAt(0).toUpperCase() + aslice; | |
return str.replace(before, caps); | |
} | |
else if(after[0] === after[0].toUpperCase() && before[0] === before[0].toLowerCase()){ | |
var low = after.charAt(0).toLowerCase() + aslice; | |
return str.replace(before, low); | |
} |