Files: 2244524e466413910788cad98baa61df4f340866 / test / test-struct.js
439 bytesRaw
1 | var Struct = require('../struct') |
2 | |
3 | var struct = Struct({ |
4 | a: 'Hello', |
5 | b: 'You', |
6 | c: 123, |
7 | d: Struct({ |
8 | tinker: 'value' |
9 | }) |
10 | }) |
11 | |
12 | console.log(struct()) |
13 | struct(x => console.log(x)) |
14 | struct.a(x => console.log('a =>', x)) |
15 | struct.b(x => console.log('b =>', x)) |
16 | struct.c(x => console.log('c =>', x)) |
17 | struct.d(x => console.log('d =>', x)) |
18 | |
19 | struct.b.set('Cat') |
20 | |
21 | struct.set({ |
22 | a: 'Hello', |
23 | b: 'Cat', |
24 | c: 123, |
25 | d: { |
26 | tinker: 456 |
27 | } |
28 | }) |
29 |
Built with git-ssb-web