Skip to content

Instantly share code, notes, and snippets.

@StanAngeloff
Created July 9, 2010 14:50
Show Gist options
  • Save StanAngeloff/469553 to your computer and use it in GitHub Desktop.
Save StanAngeloff/469553 to your computer and use it in GitHub Desktop.
mapResponse: (string, block) ->
xml2object.parse string, (error, responseObject) =>
if error
if block then block error else throw error
else
[root, map]: @responseMap
body: responseObject?['soap:Envelope']?['soap:Body']?[root]
if body
result: map2object body, map
if block then block null, result else result
else
error: new MapError "/soap:Envelope/soap:Body/$root"
if block then block error else throw error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment