-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapExamples.js
82 lines (68 loc) · 1.9 KB
/
mapExamples.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
'use strict';
var _ = require('lodash');
var aNames = ['melbourne','sydney','brisbane'];
var cObjects ={'country' :'australia',"age":20,"capital" :"canberra"};
var dogs = [{ name: "arf", age: 3}, {name:'bark', age: 5}]
// console.log(_.drop(aNames,4));
// console.log(_.findIndex(aNames,['sydney']));
//
// _.forEach(aNames,function(key,value,collection){
// console.log(value);
// console.log(collection);
// });
//
// _.forEach(cObjects,function(v,k){
// // console.log(k);
// console.log(k);
// });
//
// _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
// console.log(key);
// });
//
// var users = [
// { 'user': 'barney', 'age': 36, 'active': true },
// { 'user': 'fred', 'age': 40, 'active': false }
// ];
var applicationz = {
"application":{
"account":{
"age":20,
"name":"bbay"
},
"card" :[{
"visa" :"123",
"novis":23434
}],
"customer" : [
{ "crn" : 998,
"name":"dfslkfd"
},
{"crn" :89,
"name":"dfjdklf"
}],
"capCustomer":"23345",
"bank":"ans"
}
};
// console.log(_.flatten(_.map(application,'customer'))) ;
console.log(_.filter(applicationz,{'crn':89, 'name':'dfjdklf'}));
// console.log(_.filter(users,{'user' :'barney', 'age':36}));
// console.log(_.map(users,{'user':'barney','age':36})) ;
// console.log(_.map(users,'age')) ;
// console.log(_.filter(users,{'age':36}));
//
// _.filter(users, function(o) { return !o.active; });
// // => objects for ['fred']
//
// // The `_.matches` iteratee shorthand.
// _.filter(users, { 'age': 36, 'active': true });
// // => objects for ['barney']
//
// // The `_.matchesProperty` iteratee shorthand.
// _.filter(users, ['active', false]);
// // => objects for ['fred']
//
// // The `_.property` iteratee shorthand.
// _.filter(users, 'active');
// // => objects for ['barney']