Constructor
new Pipe(pipe)
Parameters:
Name | Type | Description |
---|---|---|
pipe | string | a pipe consists of commands whose input and output are connected with the pipe symbol |
- Since
- 1.5.0
- Copyright
- schukai GmbH
- License
- AGPLv3
Throws:
TypeError
Example
import {Pipe} from '@schukai/monster/source/data/pipe.mjs';
let obj = {
a: {
b: {
c: {
d: "world"
}
}
}
}
console.log(new Pipe('path:a.b.c.d | toupper | prefix:Hello\\ ').run(obj));
// ↦ Hello WORLD
Methods
run(value) → {*}
run a pipe
.run a pipe
Parameters:
Name | Type | Description |
---|---|---|
value | * |
Returns:
- Type:
- *
setCallback(name, callback, context) → {Transformer}
Parameters:
Name | Type | Description |
---|---|---|
name | string | |
callback | function | |
context | object |
Throws:
value is not a string
- Type
- TypeError
value is not a function
- Type
- TypeError
Returns:
- Type:
- Transformer