-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdecision_tree.json
381 lines (381 loc) · 14.6 KB
/
decision_tree.json
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
[
{
"text": "I have an <strong>unsorted array</strong>",
"nodes": [
{
"text": "I want <strong>one element</strong>",
"nodes": [
{
"text": "Does it exist?",
"nodes": [
{
"text": "I have an <strong>exact value</strong>: <a>_.includes</a>",
"href": "https://lodash.com/docs/4.17.10#includes"
},
{
"text": "I have a <strong>predicate</strong>: <a>_.some</a>",
"href": "https://lodash.com/docs/4.17.10#some"
}
]
},
{
"text": "Where is it? (an index, or null)",
"nodes": [
{
"text": "I have an <strong>exact value</strong>",
"nodes": [
{
"text": "I want the <strong>leftmost</strong> occurrence: <a>_.indexOf</a>",
"href": "https://lodash.com/docs/4.17.10#indexOf"
},
{
"text": "I want the <strong>rightmost</strong> occurence: <a>_.lastIndexOf</a>",
"href": "https://lodash.com/docs/4.17.10#lastIndexOf"
}
]
},
{
"text": "I have a <strong>predicate</strong>",
"nodes": [
{
"text": "I want the <strong>leftmost</strong> occurrence: <a>_.findIndex</a>",
"href": "https://lodash.com/docs/4.17.10#findIndex"
},
{
"text": "I want the <strong>rightmost</strong> occurence: <a>_.findLastIndex</a>",
"href": "https://lodash.com/docs/4.17.10#findLastIndex"
}
]
}
]
},
{
"text": "What exactly is the element?",
"nodes": [
{
"text": "The <strong>first</strong>: <a>_.first</a>, <a>_.head</a>",
"href": "https://lodash.com/docs/4.17.10#first"
},
{
"text": "Somewhere in the <strong>middle</strong>, by index: <a>_.nth</a>",
"href": "https://lodash.com/docs/4.17.10#nth"
},
{
"text": "The <strong>last</strong>: <a>_.last</a>",
"href": "https://lodash.com/docs/4.17.10#last"
},
{
"text": "Some <strong>random</strong> one: <a>_.sample</a>",
"href": "https://lodash.com/docs/4.17.10#sample"
},
{
"text": "I have a <strong>predicate</strong>",
"nodes": [
{
"text": "I want the <strong>leftmost</strong> occurrence: <a>_.find</a>",
"href": "https://lodash.com/docs/4.17.10#find"
},
{
"text": "I want the <strong>rightmost</strong> occurence: <a>_.findLast</a>",
"href": "https://lodash.com/docs/4.17.10#findLast"
}
]
}
]
}
]
},
{
"text": "I want a <strong>subset of elements</strong>",
"nodes": [
{
"text": "I know which ones I want",
"nodes": [
{
"text": "A bunch of items on the <strong>left</strong>",
"nodes": [
{
"text": "A fixed number of elements: <a>_.take</a>",
"href": "https://lodash.com/docs/4.17.10#take"
},
{
"text": "Moving to right while some condition is true: <a>_.takeWhile</a>",
"href": "https://lodash.com/docs/4.17.10#takeWhile"
}
]
},
{
"text": "A bunch of items on the <strong>right</strong>",
"nodes": [
{
"text": "A fixed number of elements: <a>_.takeRight</a>",
"href": "https://lodash.com/docs/4.17.10#takeRight"
},
{
"text": "Starting at the end, moving to the start while some condition is true: <a>_.takeRightWhile</a>",
"href": "https://lodash.com/docs/4.17.10#takeRightWhile"
}
]
},
{
"text": "All but the <strong>last</strong> element: <a>_.initial</a>",
"href": "https://lodash.com/docs/4.17.10#initial"
},
{
"text": "All but the <strong>first</strong> element: <a>_.tail</a>",
"href": "https://lodash.com/docs/4.17.10#tail"
},
{
"text": "A bunch in the <strong>middle</strong>, between two indicies: <a>_.slice</a>",
"href": "https://lodash.com/docs/4.17.10#slice"
},
{
"text": "Matching elements in a given array: <a>_.intersection</a>, <a>_.intersectionBy</a>, <a>_.intersectionWith</a>",
"href": "https://lodash.com/docs/4.17.10#intersection"
},
{
"text": "Matching a <strong>predicate</strong>: <a>_.filter</a>",
"href": "https://lodash.com/docs/4.17.10#filter"
}
]
},
{
"text": "I know which ones I <strong>don't</strong> want, i.e. I want to delete elements",
"nodes": [
{
"text": "A bunch of items on the <strong>left</strong>",
"nodes": [
{
"text": "A fixed number of elements: <a>_.drop</a>",
"href": "https://lodash.com/docs/4.17.10#drop"
},
{
"text": "Moving to right while some condition is true: <a>_.sropWhile</a>",
"href": "https://lodash.com/docs/4.17.10#dropWhile"
}
]
},
{
"text": "A bunch of items on the <strong>right</strong>",
"nodes": [
{
"text": "A fixed number of elements: <a>_.dropRight</a>",
"href": "https://lodash.com/docs/4.17.10#dropRight"
},
{
"text": "Starting at the end, moving to the start while some condition is true: <a>_.dropRightWhile</a>",
"href": "https://lodash.com/docs/4.17.10#dropRightWhile"
}
]
},
{
"text": "All <strong>falsey</strong> values: <a>_.compact</a>",
"href": "https://lodash.com/docs/4.17.10#compact"
},
{
"text": "All <strong>duplicate</strong> values: <a>_.uniq</a>, <a>_.uniqBy</a>, <a>_.uniqWith</a> ",
"href": "https://lodash.com/docs/4.17.10#uniq"
},
{
"text": "Some <strong>fixed</strong> values: <a>_.without</a> or <a>_.pull</a> (mutates array)",
"href": "https://lodash.com/docs/4.17.10#without"
},
{
"text": "The values at a list of particular indices: <a>_.pullAt</a> (mutates array)",
"href": "https://lodash.com/docs/4.17.10#pullAt"
},
{
"text": "Matching elements in a given array: <a>_.difference</a>, <a>_.differenceBy</a>, <a>_.differenceWith</a> OR <a>_.pullAll</a>, <a>_.pullAllBy</a>, <a>_.pullAllWith</a> (mutates array) ",
"href": "https://lodash.com/docs/4.17.10#difference"
},
{
"text": "Matching a <strong>predicate</strong>: <a>_.reject</a>, <a>_.remove</a> (mutates array)",
"href": "https://lodash.com/docs/4.17.10#reject"
}
]
},
{
"text": "Let Lodash pick them for me: <a>_.sampleSize</a>",
"href": "https://lodash.com/docs/4.17.10#sampleSize"
}
]
},
{
"text": "I want to <strong>loop</strong>: to do something with each element",
"nodes": [
{
"text": "And change each element",
"nodes": [
{
"text": "To a <strong>fixed</strong> value: <a>_.fill</a>",
"href": "https://lodash.com/docs/4.17.10#fill"
},
{
"text": "To a value returned from a <strong>function</strong>: <a>_.map</a>",
"href": "https://lodash.com/docs/4.17.10#map"
}
]
},
{
"text": "And apply a procedure, leaving the element alone",
"nodes": [
{
"text": "Starting from the <strong>left</strong>: <a>_.each</a>, <a>_.forEach</a>",
"href": "https://lodash.com/docs/4.17.10#forEach"
},
{
"text": "Starting from the <strong>right</strong>: <a>_.eachRight</a>, <a>_.forEachRight</a>",
"href": "https://lodash.com/docs/4.17.10#forEachRight"
}
]
}
]
},
{
"text": "I want to <strong>reorder<strong> the elements",
"nodes": [
{
"text": "In some <strong>random</strong> order: <a>_.shuffle</a>",
"href": "https://lodash.com/docs/4.17.10#shuffle"
},
{
"text": "In <strong>sorted</strong> order: <a>_.sortBy</a>, <a>_.orderBy</a>",
"href": "https://lodash.com/docs/4.17.10#sortBy"
},
{
"text": "In <strong>reverse</strong> order: <a>_.reverse</a>",
"href": "https://lodash.com/docs/4.17.10#reverse"
}
]
},
{
"text": "I want to change the shape of the array",
"nodes": [
{
"text": "Removing the subarrays",
"nodes": [
{
"text": "<strong>1 level</strong> deep: <a>_.flatten</a>",
"href": "https://lodash.com/docs/4.17.10#flatten"
},
{
"text": "<strong>N levels</strong> deep: <a>_.flattenDepth</a>",
"href": "https://lodash.com/docs/4.17.10#flattenDepth"
},
{
"text": "<strong>All the way down</strong> no matter how deep: <a>_.flattenDeep</a>",
"href": "https://lodash.com/docs/4.17.10#flattenDeep"
}
]
},
{
"text": "Flipping the axes: <a>_.zip</a>, <a>_.unzip</a>",
"href": "https://lodash.com/docs/4.17.10#zip"
}
]
},
{
"text": "I want some information about the array as a whole",
"nodes": [
{
"text": "The <strong>size</strong>: <a>_.size</a>",
"href": "https://lodash.com/docs/4.17.10#size"
},
{
"text": "An <strong>aggregate</strong> (sum, maximum, or whatever function you want): <a>_.reduce</a>, <a>_reduceRight</a>",
"href": "https://lodash.com/docs/4.17.10#reduce"
},
{
"text": "Whether elements conform to a predicate",
"nodes": [
{
"text": "<strong>At least one</strong> of them: <a>_.some</a>",
"href": "https://lodash.com/docs/4.17.10#flatten"
},
{
"text": "<strong>All</strong> of them: <a>_.every</a>",
"href": "https://lodash.com/docs/4.17.10#every"
},
{
"text": "<strong>How many</strong> of them: <a>_.countBy</a>",
"href": "https://lodash.com/docs/4.17.10#countBy"
}
]
}
]
},
{
"text": "I want to do something not listed above",
"nodes": [
{
"text": "<strong>Split</strong> into equal-sized subarrays: <a>_.chunk</a>",
"href": "https://lodash.com/docs/4.17.10#chunk"
},
{
"text": "<strong>Glue</strong> a bunch of elements",
"nodes": [
{
"text": "Keeping duplicates: <a>_.concat</a>",
"href": "https://lodash.com/docs/4.17.10#concat"
},
{
"text": "Removing duplicates: <a>_.union</a>, <a>_.unionBy</a>, <a>_.unionWith</a>",
"href": "https://lodash.com/docs/4.17.10#union"
}
]
},
{
"text": "Create an object from a <strong>array of 2-element subarrays</strong>: <a>_.fromPairs</a>",
"href": "https://lodash.com/docs/4.17.10#fromPairs"
},
{
"text": "<strong>Join</strong> the elements into a big string: <a>_.join</a>",
"href": "https://lodash.com/docs/4.17.10#join"
},
{
"text": "<strong>Group</strong> a bunch of elements",
"nodes": [
{
"text": "Into two arrays according to a boolean predicate: <a>_.partition</a>",
"href": "https://lodash.com/docs/4.17.10#partition"
},
{
"text": "Into an object whose properties are computed by a function: Removing duplicates: <a>_.groupBy</a>",
"href": "https://lodash.com/docs/4.17.10#groupBy"
}
]
}
]
}
]
},
{
"text": "I have a <strong>sorted array</strong>",
"nodes": [
{
"text": "I want to know where an element can be inserted to preserve order",
"nodes": [
{
"text": "The <strong>leftmost</strong> index: <a>_.sortedIndex</a>, <a>_.sortedIndexBy</a>, <a>_.sortedIndexOf</a>",
"href": "https://lodash.com/docs/4.17.10#sortedIndex"
},
{
"text": "The <strong>rightmost</strong> index: <a>_.sortedLastIndex</a>, <a>_.sortedLastIndexBy</a>, <a>_.sortedLastIndexOf</a>",
"href": "https://lodash.com/docs/4.17.10#sortedLastIndex"
}
]
},
{
"text": "I want all unique elements in sorted order: <a>_.sortedUniq</a>, <a>_.sortedUniqBy</a>",
"href": "https://lodash.com/docs/4.17.10#sortedUniq"
},
{
"text": "For everything else, see Unsorted Array above",
"href": "index.html"
}
]
},
{
"text": "I have an <strong>object</strong>"
}
]