Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Sign In

uber / deck.gl / 13340

10 Sep 2019 - 3:13 coverage decreased (-2.6%) to 80.892%
13340

Pull #3552

travis-ci-com

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
[#3548 - Part 4] Modify setup.py to specify that README is markdown
Pull Request #3552: [#3548 - Part 4] Update notebook documentation to include additional pydeck features

3330 of 4491 branches covered (74.15%)

Branch coverage included in aggregate %.

6860 of 8106 relevant lines covered (84.63%)

5923.39 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.62
/modules/aggregation-layers/src/utils/aggregation-operation-utils.js
1
// Copyright (c) 2015 - 2019 Uber Technologies, Inc.
12×
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a copy
4
// of this software and associated documentation files (the "Software"), to deal
5
// in the Software without restriction, including without limitation the rights
6
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
// copies of the Software, and to permit persons to whom the Software is
8
// furnished to do so, subject to the following conditions:
9
//
10
// The above copyright notice and this permission notice shall be included in
11
// all copies or substantial portions of the Software.
12
//
13
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
// THE SOFTWARE.
20

21
export const AGGREGATION_OPERATION = {
1×
22
  SUM: 1,
23
  MEAN: 2,
24
  MIN: 3,
25
  MAX: 4
26
};
27

28
function sumReducer(accu, cur) {
29
  return accu + cur;
65,609×
30
}
31

32
function maxReducer(accu, cur) {
33
  return cur > accu ? cur : accu;
5×
34
}
35

36
function minReducer(accu, cur) {
37
  return cur < accu ? cur : accu;
5×
38
}
39

40
export function getMean(pts, accessor) {
41
  const filtered = pts.map(accessor).filter(Number.isFinite);
665×
42

43
  return filtered.length ? filtered.reduce(sumReducer, 0) / filtered.length : null;
Branches [[2, 1]] missed. 665×
44
}
45

46
export function getSum(pts, accessor) {
47
  const filtered = pts.map(accessor).filter(Number.isFinite);
4,098×
48

49
  return filtered.length ? filtered.reduce(sumReducer, 0) : null;
Branches [[3, 1]] missed. 4,098×
50
}
51

52
export function getMax(pts, accessor) {
53
  const filtered = pts.map(accessor).filter(Number.isFinite);
1×
54

55
  return filtered.length ? filtered.reduce(maxReducer, -Infinity) : null;
Branches [[4, 1]] missed. 1×
56
}
57

58
export function getMin(pts, accessor) {
59
  const filtered = pts.map(accessor).filter(Number.isFinite);
1×
60

61
  return filtered.length ? filtered.reduce(minReducer, Infinity) : null;
Branches [[5, 1]] missed. 1×
62
}
63

64
// Function to convert from aggregation/accessor props (like colorAggregation and getColorWeight) to getValue prop (like getColorValue)
65
export function getValueFunc(aggregation, accessor) {
66
  const op = AGGREGATION_OPERATION[aggregation.toUpperCase()] || AGGREGATION_OPERATION.SUM;
35×
67
  switch (op) {
Branches [[7, 4]] missed. 35×
68
    case AGGREGATION_OPERATION.MIN:
69
      return pts => getMin(pts, accessor);
1×
70
    case AGGREGATION_OPERATION.SUM:
71
      return pts => getSum(pts, accessor);
4,098×
72
    case AGGREGATION_OPERATION.MEAN:
73
      return pts => getMean(pts, accessor);
665×
74
    case AGGREGATION_OPERATION.MAX:
75
      return pts => getMax(pts, accessor);
1×
76
    default:
UNCOV
77
      return null;
!
78
  }
79
}
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
BLOG · TWITTER · Legal & Privacy · Supported CI Services · What's a CI service? · Automated Testing

© 2019 Coveralls, LLC