Skip to content

Instantly share code, notes, and snippets.

@nrw
Last active August 29, 2015 14:02
Show Gist options
  • Save nrw/a94713930205e7915163 to your computer and use it in GitHub Desktop.
Save nrw/a94713930205e7915163 to your computer and use it in GitHub Desktop.
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