Skip to content

@ajacksified /formserialization.coffee
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Coffeescript / Underscore form serialization
serializeForm: ($el) ->
return _.reduce($el.serializeArray(), (memo, v) ->
if v.name.match(/\[\]/)
v.name = v.name.replace(/\[\]/,'')
memo[v.name] ?= []
memo[v.name].push(v.value)
else
memo[v.name] = v.value
memo
, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.