* @returns interpolation of the redirect path with the parametrs
(string, params)
| 7493 | * @returns interpolation of the redirect path with the parametrs |
| 7494 | */ |
| 7495 | function interpolate(string, params) { |
| 7496 | var result = []; |
| 7497 | forEach((string||'').split(':'), function(segment, i) { |
| 7498 | if (i == 0) { |
| 7499 | result.push(segment); |
| 7500 | } else { |
| 7501 | var segmentMatch = segment.match(/(\w+)(.*)/); |
| 7502 | var key = segmentMatch[1]; |
| 7503 | result.push(params[key]); |
| 7504 | result.push(segmentMatch[2] || ''); |
| 7505 | delete params[key]; |
| 7506 | } |
| 7507 | }); |
| 7508 | return result.join(''); |
| 7509 | } |
| 7510 | }]; |
| 7511 | } |
| 7512 |
no test coverage detected