https://github.com/g-harel/paph
data-flow-graph based tool to transform data
https://github.com/g-harel/paph
data-flow graph shortest-path transform-data
Last synced: about 2 months ago
JSON representation
data-flow-graph based tool to transform data
- Host: GitHub
- URL: https://github.com/g-harel/paph
- Owner: g-harel
- License: mit
- Created: 2017-05-16T23:07:14.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-03T18:22:27.000Z (about 7 years ago)
- Last Synced: 2025-02-19T12:19:22.709Z (2 months ago)
- Topics: data-flow, graph, shortest-path, transform-data
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [paph](https://github.com/g-harel/paph)
[](https://www.npmjs.com/package/paph)
[](https://travis-ci.org/g-harel/paph)
[](https://codecov.io/gh/g-harel/paph)> Data-flow-graph based tool to transform data.
Shortest path between `initial` and `final` is found before returning a combined function of all the transitions.
Built in protection against cycles.
## Install
````
$ npm install --save paph
````## Usage
````javascript
const paph = require('paph');const store = paph();
// creating a relationship
store.add({start, end, weight?, transition});
└─┬──┘ │ └┐
String Number Function// querying relationships
store.query(initial, final); // returns a function
└──┬───┘
String
````````javascript
const paph = require('paph');const store = paph();
store.add({
start: 'v1',
end: 'v2',
weight: 1,
transition: (data) => {
return data + '1,2 ';
},
});store.add({
start: 'v2',
end: 'v3',
weight: 1,
transition: (data) => {
return data + '2,3 ' ;
},
});store.query('v1', 'v3')('');
//=> '1,2 2,3'
````