Last active
September 23, 2016 17:57
-
-
Save MikeyBurkman/46f81047b753a22134a90a446d00e2c0 to your computer and use it in GitHub Desktop.
TS Example
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 foo = [{ | |
id: 1, | |
name: 'Mike' | |
}, { | |
id: 2, | |
name: 'Tom' | |
}, { | |
id: 3, | |
name: 'Sally' | |
}]; | |
function nameLengthGreaterThan(x: number) { | |
return (namedThing: {name: string}) => namedThing.name.length > x; | |
} | |
const longNames = foo | |
.filter(nameLengthGreaterThan(4)) | |
.map(person => person.name) | |
console.log(longNames); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment