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

callbag-map

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

callbag-map

Callbag operator that applies a transformation on data passing through it

1.1.0
latest
Source
npm
Version published
Weekly downloads
5.6K
-19.46%
Maintainers
2
Weekly downloads
 
Created
Source

/**

  • callbag-map
  • Callbag operator that applies a transformation on data passing through it.
  • Works on either pullable or listenable sources.
  • npm install callbag-map
  • Example:
  • const fromIter = require('callbag-from-iter');
    
  • const iterate = require('callbag-iterate');
    
  • const map = require('callbag-map');
    
  • const source = map(x => x * 0.1)(fromIter([10,20,30,40]));
    
  • iterate(x => console.log(x))(source); // 1
    
  •                                       // 2
    
  •                                       // 3
    
  •                                       // 4
    

*/

const map = f => source => (start, sink) => { if (start !== 0) return; source(0, (t, d) => { sink(t, t === 1 ? f(d) : d) }); };

module.exports = map;

Keywords

callbag

FAQs

Package last updated on 09 Feb 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