Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/foxted/basic-trend
Basic algorithm to detect increasing, decreasing or stable trend in a Numbers sequence
https://github.com/foxted/basic-trend
arrays sequence statistics trends
Last synced: 21 days ago
JSON representation
Basic algorithm to detect increasing, decreasing or stable trend in a Numbers sequence
- Host: GitHub
- URL: https://github.com/foxted/basic-trend
- Owner: foxted
- License: mit
- Created: 2019-12-18T15:36:42.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-05-08T02:43:01.000Z (over 1 year ago)
- Last Synced: 2024-04-29T16:22:16.402Z (6 months ago)
- Topics: arrays, sequence, statistics, trends
- Language: JavaScript
- Homepage:
- Size: 1.81 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Basic Trend
Basic algorithm to detect increasing, decreasing or stable trend in a Numbers sequence.
## Installation
```bash
$ npm install --save basic-trend
```## Usage
```javascript
import trend from 'basic-trend';const sequence = [5,4,7,8,5,2,1,4,5,2,145,7,54,2,6,5,48,6,2,4,101,4,5,75,4,1,2,4,7,5,1,2,5,65,4,4,7,8];
const trend = trend(sequence);
```## Concept
- If the given sequence appears to be increasing this method will return `1`
- If the given sequence appears to be decreasing, this method will return `-1`
- If the given sequence appears to be stable or scattered, this method will return `0`