Created
September 27, 2019 20:18
-
-
Save trycf/bcc27bbde78c9c2da80555ca07145cf5 to your computer and use it in GitHub Desktop.
TryCF Gist
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
<cfscript> | |
salesPeople = getSalesPeople(); | |
theStars = salesPeople.map((row)=>{ | |
var newRow = duplicate(row); | |
newRow["star"] = row.sales >= 10000 | |
? "*" | |
: ""; | |
return newRow; | |
}); | |
writeDump({ | |
" stars": theStars, | |
"original": salesPeople | |
}); | |
function getSalesPeople(){ | |
return [ | |
{ | |
id: 1, | |
firstName: "Susan", | |
lastName: "Lane", | |
email: "slane@gmail.com", | |
sales: 26540.43 | |
}, | |
{ | |
id: 2, | |
firstName: "John", | |
lastName: "Doe", | |
email: "johndoe@example.com", | |
sales: 54120.64 | |
}, | |
{ | |
id: 3, | |
firstName: "Mary", | |
lastName: "Smith", | |
email: "marysmith@example.com", | |
sales: 1540.78 | |
} | |
]; | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment