# edges

> An asynchronous, multipurpose, data transforming pipeline tool

Latest version **1.0.8** (published 2019-06-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install edges
pnpm add edges
yarn add edges
bun add edges
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2019-06-06 |
| First published | 2019-06-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nathan Barber |
| Maintainers | nathanbarber |

## Links

- npm: https://www.npmjs.com/package/edges
- Repository: https://github.com/nathanbarber/edges
- Homepage: https://github.com/nathanbarber/edges#readme
- Issues: https://github.com/nathanbarber/edges/issues
- npm.io page: https://npm.io/package/edges

## Recent versions

- 1.0.8 (latest) — 2019-06-06
- 1.0.7 — 2019-06-06
- 1.0.6 — 2019-06-06
- 1.0.5 — 2019-06-06
- 1.0.4 — 2019-06-06
- 1.0.2 — 2019-06-06
- 1.0.1 — 2019-06-06
- 1.0.0 — 2019-06-06

## README

# For Quick Async Data Operations

Edges takes a user-specified data chunk and performs asynchronous tasks on it, returning the end result.
The point of this project is to create a data pipeline framework that can take full advantage of the async nature of Node.js.

# Usage

Edges works by being assigned named async functions and then updating a schema-based JSON object with the ending of each subsequent Promise.  
Here are the Docs so far.

## Initializing your Edge
```javascript
const Edges = require("edges"),
    Edge = new Edges({
        //Your JSON Schema Here
    });
```

## Data-to-schema
If you want to create a schema out of an existing chunk of data, you can initialize your Edge with the static `Edge.shape()` method.
```javascript
Edge = new Edges(Edges.shape({
    // Your chunk of data here
}));
```

## Adding a task  
For each task, add a descriptor and an asynchronous function with one parameter for the data you'll be modifying. You can have any number of tasks.
```javascript
Edge.task("populate data for something", async inputData => {
    // perform some async task
    let datapoint = await rp.get("{some-api-url}");
    // modify your data
    inputData.some_random_property = datapoint;
    // send it back into the mix
    return inputData;
});
```


## Running your tasks
When running tasks, be sure to have your first argument as an array of task names (`['task1', 'task2', ...]`), and your second argument as the data to be modified through the async process.   
The object that's fed in to `Edge.runs()` will be checked for likeness to the 'shape' object defined in the Edge constructor.   
`Edge.runs()` will return a Promise containing the modified data.
```javascript
Edge.runs(["populate data for something", "another task", "..."], {/* Your schema based object */})
.then(datas => {
    // Woot
    console.log(datas);
})
.catch(err => {
    // Shoot
    throw err;
});
```

---
_Source: https://npm.io/package/edges · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
