Skip to content

Commit

Permalink
updated doc
Browse files Browse the repository at this point in the history
  • Loading branch information
tmhglnd committed Dec 9, 2020
1 parent f64f5ea commit 644bf6d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,8 @@
- [multiply](./utility-methods.md#usage)
- [divide](./utility-methods.md#usage)
- [mod](./utility-methods.md#usage)
- [minimum](./utility-methods.md#minimum)
- [maximum](./utility-methods.md#maximum)
- [normalize](./utility-methods.md#normalize)
- [plot](./utility-methods.md#plot)
- [draw](./utility-methods.md#draw)
37 changes: 37 additions & 0 deletions docs/utility-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,43 @@ Util.divide([1, 2, 3, 4], [1, 2, 3]);
//=> [ 1, 1, 1, 4 ]
```

## minimum

Return the minimum value from an array (Also part of `.Statistic`)

```js
Util.minimum([-38, -53, -6, 33, 88, 32, -8, 73]);
//=> -53
// Alternative: Util.min()
```

## maximum

Return the maximum value from an array (Also part of `.Statistic`)

```js
Util.maximum([-38, -53, -6, 33, 88, 32, -8, 73]);
//=> 88
// Alternative: Util.max()
```

## normalize

Normalize all the values in an array between 0. and 1.
The highest value will be 1, the lowest value will be 0.

**arguments**
- {Number/Array} -> input values
- {Int/Array} -> normailzed values

```js
Util.normalize([0, 1, 2, 3, 4]);
//=> [ 0, 0.25, 0.5, 0.75, 1 ]

Util.normalize([5, 12, 4, 17, 3]);
//=> [ 0.14285714285714285, 0.6428571428571429, 0.07142857142857142, 1, 0 ]
```

## plot

Plot an array of values to the console in the form of an ascii chart and return chart from function. If you just want the chart returned as text and not log to console set { log: false }. Using the asciichart package by x84.
Expand Down

0 comments on commit 644bf6d

Please sign in to comment.