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
| const hasDebutAfter1980 = character => character.debut > 1980; | |
| const withEvery = characters.every(hasDebutAfter1980); | |
| const withReduce = characters.reduce((accumulator, character) => { | |
| if(hasDebutAfter1980(character)) { | |
| return true; | |
| } | |
| return accumulator && hasDebutAfter1980(character); |
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
| const withSome = characters.some(character => character.debut < 1990); | |
| const withReduce = characters.reduce((accumulator, character) => { | |
| if(character.debut < 1990) { | |
| return true; | |
| } | |
| return accumulator; | |
| }, false); | |
| // true |
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
| characters.filter(character => character.debut < 1990).length > 0; | |
| // true; |
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
| const mapped = characters.map(character => character.name); | |
| const reduced = characters.reduce((accumulator, character) => [...accumulator, character.name], []); | |
| // [ | |
| // "Donkey Kong", | |
| // "Captain Falcon", | |
| // "Fox", | |
| // "Kirby", | |
| // "Link" |
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
| const filtered = characters.filter(character => character.debut < 1990); | |
| const reduced = characters.reduce((accumulator, character) => { | |
| if(character.debut < 1990) { | |
| return [...accumulator, character]; | |
| } | |
| return accumulator; | |
| }, []); |
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
| const list = [ | |
| { | |
| id: "772b70fa-57be-40fc-976a-1123320df94e", | |
| name: "Jupiter" | |
| }, | |
| { | |
| id: "cced1a50-19b7-4971-aacc-a732eb5ec64c", | |
| name: "Saturn" | |
| }, | |
| { |
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
| const list = [1, 2, 3, 4, 5]; | |
| const result = list.reduce((accumulator, item) => { | |
| return accumulator + item; | |
| }, 0); | |
| console.log(result); // 15 |
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
| git config --global alias.tags "tag --sort version:refname" |
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
| .container { | |
| -ms-overflow-style: none; /* IE 10+ */ | |
| overflow: -moz-scrollbars-none; /* Firefox */ | |
| } | |
| .container::-webkit-scrollbar { | |
| display: none; /* Safari and Chrome */ | |
| } |
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
| # /etc/systemd/system/couchdb.service | |
| [Unit] | |
| Description=Couchdb service | |
| After=network.target | |
| [Service] | |
| Type=simple | |
| User=couchdb | |
| ExecStart=/opt/couchdb/bin/couchdb -o /dev/stdout -e /dev/stderr |