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 employees = [ | |
{ id: 101, name: 'john', group: 'tech-lead' }, | |
{ id: 102, name: 'sam', group: 'associate' }, | |
{ id: 103, name: 'danny', group: 'senior associate' }, | |
{ id: 104, name: 'ketty', group: 'senior associate' }, | |
{ id: 105, name: 'mili', group: 'junior' }, | |
{ id: 106, name: 'mouli', group: 'senior associate' }, | |
{ id: 107, name: 'George', group: 'senior associate' } | |
]; |
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 aoa = [[1,2,3],[4,5,6],[7,8,9]]; | |
const flatteredArr = aoa.reduce((acc,arr) => [...acc , ...arr]); |
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 personObject = [ | |
{ | |
"id":1, | |
"name": "A", | |
"experienceInYear": 5, | |
"designation" : "senior associate" | |
}, | |
{ | |
"id":2, | |
"name": "B", |
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 numbers = [1,2,3,4,5,6,7,8,9]; | |
const { evenNumbers, oddNumbers} = numbers.reduce((obj,number) => { | |
if( number % 2 === 0){ | |
obj.evenNumbers.push(number); | |
}else{ | |
obj.oddNumbers.push(number); | |
} | |
return Object.assign({},obj); |
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 arr = [ | |
[{ id : 1, name: "a" },{ id : 2, name: "b" }], | |
[{ id : 3, name: "c" },{ id : 4, name: "d" }] | |
] | |
const filteredArr = arr.reduce((a,b) => a.concat(b)) | |
.filter((obj) => obj.id === 3); | |
console.log(filteredArr) |
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 employees = [ | |
{ id: 101, name: 'john', group: 'tech-lead' }, | |
{ id: 102, name: 'sam', group: 'associate' }, | |
{ id: 103, name: 'danny', group: 'senior associate' }, | |
{ id: 104, name: 'ketty', group: 'senior associate' }, | |
{ id: 105, name: 'mili', group: 'junior' }, | |
{ id: 106, name: 'mouli', group: 'senior associate' }, | |
{ id: 107, name: 'George', group: 'senior associate' } | |
]; |
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 validateEmail = (email) => { | |
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
return re.test(email.toLowerCase()); | |
} |
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
private eventsSubscription: any | |
@Input() events: Observable<void>; | |
ngOnInit(){ | |
this.eventsSubscription = this.events.subscribe(() => doSomething()) | |
} | |
ngOnDestroy() { | |
this.eventsSubscription.unsubscribe() |
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
{ | |
headerName: this.utilsService.setColumnHeader('first_name', this.headerName), | |
field: 'name', | |
resizable: true, | |
sortable: true, | |
filter: true, | |
sortingOrder: ['asc', 'desc'], | |
width: 160, | |
comparator: (valueA, valueB, nodeA, nodeB, isInverted) => { | |
return this.caseInsensitiveSort(valueA, valueB, nodeA, nodeB, isInverted); } |
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
<hello name="{{ name }}"></hello> | |
<p> | |
Start editing to see some magic happen :) | |
</p> | |
<img [src]="url" height="200"> <br/> | |
<input type='file' (change)="onSelectFile($event)"> |
NewerOlder