This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var param = stream.getData() //This is bollocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------click-------click---------click-------> | |
********************************************** | |
----------------"a=1&a=2&b=3"----------------> | |
********************************************** | |
------------"a=1&a=2&b=3"--------------------> | |
observablePerPair |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Rx = require('rx'); | |
var | |
observablePerPair = function(string) { | |
return Rx.Observable.from(string.split('&')); | |
}, | |
splitEqual = function(pairString) { | |
return pairString.split('='); | |
}, | |
key = function (pair) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
a: [ | |
['a', '1'], | |
['a', '2'] | |
], | |
b: [ | |
['b', '3'] | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"a=1&a=2&b=3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var R = require('ramda'); | |
var | |
//[[key, value]] -> {key: [[key, value]]} | |
groupByKey = R.groupBy(R.head), | |
//{'':a, 'b':b} -> {'b':b} | |
rejectEmptyKeys = R.pickBy(function(value, key) {return key !== '';}), | |
//[[key, value]] -> [value | undefined] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function objectizeUrlSearch (paramString) { | |
var | |
pairStrings = paramString.split('&'), | |
pairs = [], | |
result = {}, | |
i; | |
for (i = 0; i < pairStrings.length; i++) { | |
pairs.push(pairStrings[i].split('=')); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[['a', '1'], ['a', '2'], ['b', '3']] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
['a=1','a=2', 'b=3'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var UrlSearch = require("./url-search"); | |
describe("objectizeUrlSearch", function () { | |
it("should convert search string to search object", function() { | |
var | |
urlSearch = "a=1&a=2&b=3", | |
searchObject = { | |
"a": ["1","2"], | |
"b": "3" | |
}; | |
expect(UrlSearch.objectizeUrlSearch(urlSearch)) |
NewerOlder