-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.spl.js
39 lines (27 loc) · 891 Bytes
/
map.spl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const GF = require('../index');
const users = [
{ user: 'barney', age: 36, active: true, heigh: 10 },
{ user: 'barney', age: 36, active: true, heigh: 12 },
{ user: 'fred', age: 40, active: false, heigh: 11 },
{ user: 'barney', age: 40, active: true, heigh: 12 }
];
console.log(users);
usernames = users.mapBy('user');
console.log(usernames);
shortUsers = users.mapBy(['user','active']);
console.log(shortUsers)
// ages = users.mapBy('age');
// // console.log(ages);
// //map by name
// susers = users.mapBy(['user']);
// console.log(susers);
// heighs = users.mapBy('heigh');
// // t = susers.assignProbs({
// // age: ages,
// // heigh: heighs,
// // id: (function* () { let i = 0; while (true) yield i++ })()
// // });
// console.log('susers', susers);
// console.log('t', t);
// susers = users.mapBy(['user','active']);
// console.log(susers);