Last active
May 17, 2017 11:58
-
-
Save markmeeus/0df641ed007ca38ba86254b27a97910b to your computer and use it in GitHub Desktop.
smallson
This file contains hidden or 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
//Schema bevat array met prop names | |
//eerste waarde van de value array is de naam van het schema | |
{ | |
schemas:{ | |
"a": ["name", "firstname", "address"], | |
"b": ["code", "description"] | |
}, | |
values:[ | |
["a", "Doe", "John", "meir 150"], | |
["b", "23321T5", "Te laat opgestaan"] | |
] | |
} | |
//indien 1 schema kan het eerste item weggelaten worden | |
{ | |
schemas:{ | |
"a": ["name", "firstname", "address"] | |
}, | |
values:[ | |
["Doe", "John", "meir 150"] | |
] | |
} | |
//encoding | |
//=> elk schema wordt afgeleid van de values | |
smallson.encode(values) | |
//slechts 1 schema, bespaart de moeite om het schema af te leiden | |
smallson.encode(values, ["name", "code", "description"]) | |
//decoding | |
smallson.decode(values) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice work!