value-type

little type system for values

value-type

Annotates a value by wrapping it with a type label. Kinda handy for passing around mixed typed query parameter values over urls when you don't want to use JSON.

component

  $ component install gjohnson/value-type

or

npm

  $ npm install value-type
var vt = require('value-type');
var assert = require('better-assert');
 
var str = qs.stringify({
  name: vt.encode('foobar'),
  number: vt.encode(100),
  email: vt.encode(null)
});
 
var expected = 'name=$1(foobar)&number=$2(100)&email=$4(null)';
assert(decodeURIComponent(str) == expected);

MIT