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
@Component({}) | |
export class AppComponent { | |
readonly noneMessage = "nothing"; | |
readonly selectSeat$ = new Subject<number>(); | |
readonly selectedMessage$ = this.selectSeat$.pipe( | |
scan(registerSeats, new Set<number>()), | |
startWith(new Set<number>()), | |
map(set => (set.size ? Array.from(set).join(", ") : this.noneMessage)), |
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 expandObjWithStatus(obj, condition) { | |
return { | |
...obj, | |
...(condition && { | |
status: 'modified' | |
}) | |
} | |
} |
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 client = {name: 'John', login: 'john45', secretKey: 'xyz123'}; | |
const {secretKey, ...clientData} = client; | |
clientData // {name: 'John', login: 'john45'}; |
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 environment = { | |
type: 'prod', | |
variables: { | |
api: 'some-url', | |
port: '8080' | |
} | |
} | |
const { | |
type: envType, // we extract "type" and call it "envType" here |
OlderNewer