Files: b2fdeb4fd6885660fbabd2c35067dd8f334cd4d6 / test / test-map.js
594 bytesRaw
1 | var Array = require('../array') |
2 | var Map = require('../map') |
3 | var Value = require('../value') |
4 | var computed = require('../computed') |
5 | |
6 | var value = Value('human') |
7 | var array = Array(['cat']) |
8 | var map = Map(array, function (obj) { |
9 | if (typeof obj === 'function') { |
10 | console.log('mapping => obs') |
11 | return computed([obj], (x) => x + ' [dynamic]') |
12 | } else { |
13 | console.log('mapping => ', obj) |
14 | return obj + ' [static]' |
15 | } |
16 | }) |
17 | |
18 | map(x => console.log(x)) |
19 | |
20 | array.push('dog') |
21 | array.push('cow') |
22 | array.push(value) |
23 | array.push('chicken') |
24 | array.push('wolf') |
25 | array.insert('sheep', 0) |
26 | value.set('monkey') |
27 |
Built with git-ssb-web