Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaw977/callbag-map-delve
Callbag operator that applies a transformation, which may be dot-notated path, on data passing through it
https://github.com/jaw977/callbag-map-delve
callbag
Last synced: 3 months ago
JSON representation
Callbag operator that applies a transformation, which may be dot-notated path, on data passing through it
- Host: GitHub
- URL: https://github.com/jaw977/callbag-map-delve
- Owner: jaw977
- License: mit
- Created: 2018-02-26T13:50:02.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-22T14:44:15.000Z (almost 7 years ago)
- Last Synced: 2024-10-12T23:26:36.071Z (3 months ago)
- Topics: callbag
- Language: JavaScript
- Size: 5.86 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-callbags - map-delve
README
# callbag-map-delve
Callbag operator that applies a transformation on data passing through it.
Works on either pullable or listenable sources.The transformation may be a string containing a dot-notated path to get
in a (nested) object. A default value may be passed to use if the full
path does not exist or the value is undefined. (see the `dlv` module).Otherwise, the transformation is assumed to be a function.
In this case it works exactly like callbag-map.`npm install callbag-map-delve`
## Example:
```js
const { pipe, fromIter, forEach } = require('callbag-basics');
const map = require('callbag-map-delve');
pipe(
fromIter([ {person:{name:"Jason"}},
{person:{name:"Monica"}},
{} ]),
map("person.name", "Unknown"),
map(name => "Name: " + name),
forEach(x => console.log(x)) // Name: Jason
// Name: Monica
// Name: Unknown
);
```