4 kyu
UriBuilder
1,567 of 1,678jhoffner
Description:
Create a basic UriBuilder object that will be used specifically to build query params on an existing URI. It should support a params property and a build method. It will handle the URL having pre-existing params that need to be managed. The URL must be properly encoded (i.e. "a b" should be encoded as "a%20b")
Examples of how the builder will be used:
var builder = new UriBuilder('http://www.codewars.com')
builder.params.page = 1
builder.params.language = 'javascript'
// new builder instance to demonstrate pre-existing params.
builder = new UriBuilder('http://www.codewars.com?page=1')
builder.params.page = 2
// should return 'http://www.codewars.com?page=2'
builder.build()
// if you delete params then they will disappear from the url string
delete builder.params.page
// should return 'http://www.codewars.com'
builder.build()
Note: For extra style points you can have your solution handle array values as query parameters, however there are no tests that explicitly test for them.
Object-oriented Programming
Strings
Parsing
Algorithms
Stats:
Created | Jul 23, 2013 |
Published | Jul 23, 2013 |
Warriors Trained | 3616 |
Total Skips | 1056 |
Total Code Submissions | 14793 |
Total Times Completed | 1678 |
JavaScript Completions | 1567 |
CoffeeScript Completions | 100 |
Total Stars | 110 |
% of votes with a positive feedback rating | 87% of 218 |
Total "Very Satisfied" Votes | 169 |
Total "Somewhat Satisfied" Votes | 43 |
Total "Not Satisfied" Votes | 6 |