Last active
August 29, 2015 14:02
-
-
Save nrw/a94713930205e7915163 to your computer and use it in GitHub Desktop.
This file contains 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
var people = varhash({}, function setPerson (obj, key), { | |
return struct({ | |
id: key, | |
name: value(obj.name) | |
}) | |
}) | |
var teams = varhash({}, function setTeam (obj, key) { | |
return struct({ | |
id: key, | |
people: array(obj.people) | |
}) | |
}) | |
var state = struct({ | |
people: people, | |
teams: teams | |
}) | |
state.people.put('tom', { | |
name: 'Tom Collins' | |
}) | |
state.people.put('shirley', { | |
name: 'Shirley Temple' | |
}) | |
state.teams.put('tom:shirley', { | |
people: ['tom', 'shirley'] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment