New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

edges

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

edges

An asynchronous, multipurpose, data transforming pipeline tool

  • 1.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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

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.

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.

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.

Edge.runs(["populate data for something", "another task", "..."], {/* Your schema based object */})
.then(datas => {
    // Woot
    console.log(datas);
})
.catch(err => {
    // Shoot
    throw err;
});

FAQs

Package last updated on 06 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc