value-type
v0.0.1
Published
little type system for values
Downloads
3
Readme
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.
Installation
component
$ component install gjohnson/value-type
or
npm
$ npm install value-type
Example
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);
License
MIT