Skip to content

Instantly share code, notes, and snippets.

@dvv
Created May 3, 2010 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvv/388144 to your computer and use it in GitHub Desktop.
Save dvv/388144 to your computer and use it in GitHub Desktop.
function stringToValue(string, parameters){
switch(string){
case "true": return true;
case "false": return false;
case "null": return null;
default:
// DVV: handle arrays
if (string.indexOf(',') > -1) {
var r = [];
string.split(',').forEach(function(x){
r.push(stringToValue(x, parameters));
});
return r;
}
// handle scalars
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment