Skip to content

Instantly share code, notes, and snippets.

@markmeeus
Last active May 17, 2017 11:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markmeeus/0df641ed007ca38ba86254b27a97910b to your computer and use it in GitHub Desktop.
Save markmeeus/0df641ed007ca38ba86254b27a97910b to your computer and use it in GitHub Desktop.
smallson
//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)
@iandeherdt
Copy link

Nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment