Normalize nested params in JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis.yml
README.markdown
bower.json
normalize_nested_params.js
package.json

README.markdown

normalize_nested_params.js

Build Status

Original idea comes from Rack::Utils#normalize_nested_params, see it at http://rack.rubyforge.org/doc/Rack/Utils.html

This function is binding to underscore.js's namespace.

e.g.

_.normalize_nested_params(obj, "contents[][style]", 'bold') #=> {"contents":[{"style":"bold"}]}
_.normalize_nested_params(obj, "contents[][style]")         #=> 'bold'

See more examples in Test Cases.

Run tests, add "debug_normalize_nested_params" to location search string

Copyright

MIT. David Chen at 17zuoye.