7 kyu
Manipulate URL Parameters
710 of 733AKJ.IO
Loading description...
Strings
Parsing
Regular Expressions
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Este Kata esta mal explicado ya que no se indica informacion se debe generar si falta un parametro pero solo hay 3 ejemplos donde se informa el error que se presenta haciendo que el que falte un parametro como un error del que no se tiene registro
such a poor description i can't understand what we got in parameters and testcases doesn't help at all because it is all broken for console.log()
Cannot read property 'split' of undefined Is there mistake or what? There is a param, but it shows undefined for some reason... Is there something wrong with versions?
I even set a default parameter for function addOrChangeUrlParameter(url, val = ""), but not working (Cannot read property 'split' of undefined,) It IS defined, always, even when not passed in..
need more explanation I passed all Examples and Sample Tests, but I can't understand this rule at all.
what is "Should modify parameter..." in the tests case? even though I changed parameter.
I should do like this, right? addOrChangeUrlParameter("www.example.com?key=oldValue`", "key=newValue" ) // ->'www.example.com?key=newValue' (changes the parameter).
I thought first parameter starts with '?' + '=' and second parameter starts with '&' + '=', so on.. right?
Node 12 should be enabled (Refer this and this for more info)
The logs in tests should be removed
No sample tests in CS
No random tests in CS
Test.expect
should be replaced withTest.assertEquals
in CSInitial tests need tuning - they pass even when the raw url argument is returned.
This comment has been hidden.
Hey, this Kata need more description, and fix the Test Cases, because, not run and my code is ready and run correctly.
This comment has been hidden.
Need better description and user test cases and final tests don't match
This comment has been hidden.
I am a beginner but when I run the code it says "impressive" and passed all tests but when I hit submit it says that something is wrong. I ran the test in an external text editor and it works so I am not sure why it isn't working. I am using javascript.
Test cases should probably use assertEquals instead expect, as they don't fail when incorrect value is returned.
This comment has been hidden.
The test cases are wrong, incorrect results are accepted:
function addOrChangeUrlParameter (url, param) { var url = url.split('?'); var result = url + param; return result }
http://www.google.com,ID=222TYPE=188 Test Passed
It is accepted, although there are not any '?' or '&' mark.
This comment has been hidden.
Test cases do not work
This comment has been hidden.
Inconsistent instructions and tests (in JS version), as far as mixing and adding '&', '?', and '/' signs.
Description modified to fit the test cases.
This comment has been hidden.
Error in description: param list is ...?key1=1?key2=2, should be : ...?key1=1&key2=2
Fixed.
This comment has been hidden.
Needs more tests and some fixes for the description
This comment has been hidden.
The second example contains a second "?" character. Should be "&". :)
Every example given requires ensuring there is a'/' between the url and the parameters, yet I couldn't pass the second submission test only because of that slash. The third test's failure message isn't helpful either. Please update the tests or examples for what you are looking for.
This comment has been hidden.
I pass the tests but when I submit. Something is wrong with this kata.
Needs a test.
It's unspecified what to return if a parameter already occurs multiple times in the URL, e.g.
addOrChangeUrlParameter('www.example.com/?key=value1&key=value2', 'key=value3')
.This comment has been hidden.
The description is wrong for adding a second parameter. The shown delimiter is a
?
instead of a&
.This comment has been hidden.
I was unable to build tests that were to successfully complete all the challenge. I'd recommend adding the tests for us so that we already have what we must expect
This comment has been hidden.
This comment has been hidden.
Test cases are wrong (uses expect instead of assertEqual, so basically everything passes).
This comment has been hidden.
description is very unclear.
I updated it with some examples. I'll try to be more active on this site again :) sorry!
This comment has been hidden.
No details about what to implement. Even just some tests to show how it should behave would be useful. At first it appears as though it should just concatenate strings.
This comment has been hidden.
No set tests to help out, very vague instructions.
More information would be nice, like some tests, which provide something about how data will be passed.
It might be helpful to mention the basic format of url paramaters (i.e. www.example.com/?key1=value1&key2=value2
The description should provide an information about format of parameter, because it's not clear from description, that "param" contains a parameter name and parameter value.
This comment has been hidden.
Please provide more detailed description of the task and some example test cases as well.
Needs more test cases involving multiple parameters.
It's no examples how does 'param' comes - in text or in associative array.
This comment has been hidden.
Used your examples, thanks :)
You have to know that the param parameter is a string like "key=value". This should be documented in the kata's description.
It's not clear what "param" is, give an example or two
commit check has no this kind of situation:
url has "&", so I cheat pass
This Kata has a poor description that does not fully specify what the input will look like. Instead of adding a useless comment into the code, a more vigorous description with input details would be useful.
I agree that it should be documented what the "param" value will contain, especially since there's no default test fixture where you could check the parameters out.
That said, this kata is rather ungainly. Rather than a "key=value" given as param, a more useful implementation would give a hash with multiple key-value pairs. I don't think it would even affect the kata's difficulty by much.
I was a little confused what format the param argument is. Maybe say it's a string with the form key=value (since it could be an array of length two, or an object with value and key properties).
Poor and confusing documentation.
This kata has been placed back into beta so that its description can be fleshed out more.
I think this kata is poorly conceived and documented. As rattigan pointed out, there is no explanation or reason for passing params as strings instead of key-value hash. I finally managed to discover it by logging to the console to force output during the kata test fixture... that shouldn't be necessary.
this kata should also check for adding / changing parameter in case on initial URL containing 2 or more parameters (e.g. http://example.com?param1=123¶m2=1234)
This kata needs better documentation. I wasn't able to solve it because I assumed a hash would be passed in, as suggested by the above comment.
It seems test cases have mistakes when test with no-param URL and hash
E.g:
addOrChangeUrlParameter('google.com/#/?q=test', {q:'new query'})
-->google.com/?q=new%20query#/?q=test
It seems that the default function name is not the one used by test cases. The default was changeUrlParameters instead of addOrChangeUrlParameter... or maybe I did something wrong ?
That's right, I don't know how that one skipped my view, It's changed and I also added a CoffeeScript version! Sorry! Thanks for informing me!