Status/Resolution/Reason: To Test//Fixed
Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron ()
Created: 04/04/2017
Components: Language, Closures
Versions: 2016
Failure Type: Enhancement Request
Found In Build/Fixed In Build: CF 2016 /
Priority/Frequency: Normal /
Locale/System: / Platforms All
Vote Count: 2
Here's a usecase that came up today:
http://trycf.com/gist/4aceb6cc13cc6f9a6e73ffbad9d83012/acf2016?theme=monokai
```
<cfscript>
postcode = "E18 1ED";
nato = postcode.listToArray("").map(function(c){
var natoWords = {
"A": "Alfa",
"B": "Bravo",
"C": "Charlie",
// etc
"X": "X-ray",
"Y": "Yankee",
"Z": "Zulu"
};
return natoWords[c] ?: c;
});
writeOutput(nato.toList(""));
</cfscript>
```
This converts the string to an array and back. It's a god case for just being able to do:
```
writeOutput(postcode.map(function(c){ /* etc */});
```
"Needless" to say all the higher order functions ought to be implemented for strings. I'm not just suggesting implementing map.
Attachments:
Comments: