Skip to content

Instantly share code, notes, and snippets.

@sintaxi
Created November 8, 2019 00:14
Show Gist options
  • Save sintaxi/d5d3fbd0e2dbce1d6b347d68778255af to your computer and use it in GitHub Desktop.
Save sintaxi/d5d3fbd0e2dbce1d6b347d68778255af to your computer and use it in GitHub Desktop.
exports.encode = function(txt){
return JSON.stringify({a: "hello world"}).replace(/^\{\"a\"\:\"/, "").replace(/\"\}$/, "")
}
exports.decode = function(line){
return JSON.parse('{"a": "' + line + '"}')["a"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment