@raindrops-on-roses/number-cumulative-average 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @raindrops-on-roses/number-cumulative-average
|
|
2
2
|
|
|
3
|
+
Calculates the cumulative average of the provided values.
|
|
4
|
+
|
|
3
5
|
`cumulativeAverage` utility from [raindrops-on-roses](https://www.npmjs.com/package/raindrops-on-roses).
|
|
4
6
|
|
|
5
7
|
## Install
|
|
@@ -12,8 +14,29 @@ npm install @raindrops-on-roses/number-cumulative-average
|
|
|
12
14
|
|
|
13
15
|
```ts
|
|
14
16
|
import { cumulativeAverage } from "@raindrops-on-roses/number-cumulative-average";
|
|
17
|
+
|
|
18
|
+
cumulativeAverage({
|
|
19
|
+
values: [10, 20, 30, 40],
|
|
20
|
+
}); // [10, 15, 20, 25]
|
|
21
|
+
|
|
22
|
+
cumulativeAverage({
|
|
23
|
+
values: [10, null, 20, undefined, 30],
|
|
24
|
+
}); // [10, null, 15, undefined, 20]
|
|
25
|
+
|
|
26
|
+
cumulativeAverage({
|
|
27
|
+
values: [10, null, 20, undefined, 30],
|
|
28
|
+
config: {
|
|
29
|
+
keepInvalid: false,
|
|
30
|
+
},
|
|
31
|
+
}); // [10, 15, 20]
|
|
15
32
|
```
|
|
16
33
|
|
|
34
|
+
### Parameters
|
|
35
|
+
|
|
36
|
+
- `values` - The numeric series to process
|
|
37
|
+
- `config.keepInvalid` - Keep invalid values in the output
|
|
38
|
+
- `config.convertInvalidToZero` - Converts invalid values to 0 if `config.keepInvalid` is `true`
|
|
39
|
+
|
|
17
40
|
## With the complete library
|
|
18
41
|
|
|
19
42
|
You can also install the complete library:
|
|
@@ -28,6 +51,10 @@ and import the utility from the umbrella package:
|
|
|
28
51
|
import { cumulativeAverage } from "raindrops-on-roses";
|
|
29
52
|
```
|
|
30
53
|
|
|
54
|
+
## Lore
|
|
55
|
+
|
|
56
|
+
Every new experience changes ever so slightly the average that came before.
|
|
57
|
+
|
|
31
58
|
## Repository
|
|
32
59
|
|
|
33
60
|
[graphieros/raindrops-on-roses](https://github.com/graphieros/raindrops-on-roses)
|