troch / path-parser

A small utility to parse paths.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can you help my with matrix parameters?

max-mykhailenko opened this issue · comments

Please, add example path and rule for matrix parameters, can't understand that

You can look at the tests: https://github.com/troch/path-parser/blob/master/test/main.js#L122-L129

Matrix parameters is something very obscure though, do you have the capabilities to support them with your backend? I am not sure to support them very well. I don't make them optional like query parameters.

They are like regular URL parameters but look more like query parameters (but placed anywhere before ?). You can define a matrix param by using ;key instead of :key and it will parse them from your URL expecting ;key=value.

Thanks!

I thought, that matrix parameters can resolve my problem. I have object like

  {setiD: 2, variations: "12-13-4", elements="2-3"},
  {setiD: 4, variations: "11-12-6", elements="2"},
  {setiD: 5, variations: "18-13-8", elements="1"}
]

And don't know how I can put it to hash with clear structure

best idea was /;set;variations;elements/, but I can't repeat that pattern multiple times