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 regex = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/u | |
const result = regex.exec('2018-07-05') | |
console.log(result[0]) // > '2018-07-05' | |
console.log(result[1]) // > '2018' | |
console.log(result[2]) // > '07' | |
console.log(result[3]) // > '05' | |
console.log(result.groups.year) // > '2018' | |
console.log(result.groups.month) // > '07' |
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
{ | |
"hero": { | |
"heading": "Flavio Corpa", | |
"subheading": "JavaScript", | |
"titles": [ | |
"Engineer", | |
"Ninja", | |
"Jedi", | |
"Rockstar", | |
"Djinn", |
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
case “REMOVE_LIST_ELEMENT”: | |
return [...xs.slice(0, xs.indexOf(index)), ...xs.slice(xs.indexOf(index + 1))]; |
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
xs->Belt.List.keep(x => x != item); |
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 city = cities.find(x => x.id === cityId); |
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
let city = cities->Belt.List.getBy(x => x.id == cityId); |
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
switch(city) { | |
| None => Js.log(“not found!”) | |
| Some(city) => Js.log(“found:” ++ city.name) | |
} |
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
<ul> | |
{[“foo”, “bar”, “baz”].map((x, key) => <li key={key}>{x}</li>)} | |
</ul> |
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
<ul> | |
{[|“foo”, “bar”, “baz”|] | |
->Belt.Array.mapWithIndex((key, x) => {let key = string_of_int(key); <li key>{ReasonReact.string(x)}</li>}) | |
->ReasonReact.array} | |
</ul> |
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
{ | |
"1782228941182106890_3448238252": [ | |
{ | |
"from": { | |
"full_name": "rosaparksragdoll" | |
}, | |
"text": "Hello Lovely 🐈🐾" | |
} | |
], | |
"1878968952505694822_3448238252": [ |