Created
March 18, 2014 18:05
-
-
Save jpwsutton/9625808 to your computer and use it in GitHub Desktop.
Sanitised Owntracks packet for being stored in mongoDB
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
// The received message is stored in 'msg' | |
// It will have at least a 'payload' property: | |
// console.log(msg.payload); | |
// The 'context' object is available to store state | |
// between invocations of the function | |
// context = {}; | |
var date = new Date().toISOString().slice(0, 19).replace('T', ' '); | |
var user = 'james'; | |
msg.payload = JSON.parse(msg.payload); | |
msg.payload.user = user; | |
msg.payload.date = date; | |
return msg; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment