blob: 34738ad23509ac0e5eb9ee3dbf757e00c77e5fa1 [file] [log] [blame]
/**
* Sample code using the experimental Swift 3 runtime
* Equivalent to unix cat command.
* Return all the lines in an array. All other fields in the input message are stripped.
* @param lines An array of strings.
*/
func main(args: [String:Any]) -> [String:Any] {
if let lines = args["lines"] as? [Any] {
var payload = ""
for line in lines {
payload += "\(line)\n"
}
return ["lines": lines, "payload": payload]
} else {
return ["error": "You must specify a lines parameter!"]
}
}