Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeySplitter don't work for short parameter #119

Open
ludoo0d0a opened this issue Nov 11, 2015 · 1 comment
Open

KeySplitter don't work for short parameter #119

ludoo0d0a opened this issue Nov 11, 2015 · 1 comment

Comments

@ludoo0d0a
Copy link

Using parameter like 'q' failed into the keysplitter. It falsy consider it as an array.

Here is a proposal for fix :

Backbone.Syphon.KeySplitter = function(key){
  var matches = key.match(/[^\[\]]+/g);

  //Hack for short parameter
  if (key.length>2 && key.indexOf("[]") === key.length - 2){
    lastKey = matches.pop();
    matches.push([lastKey]);
  }

  return matches;
}
@samccone
Copy link
Member

@ludoo0d0a patches welcome with tests :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants