Skip to content

This is a simple function that allows you to pipe the results of one function to a series of other functions

Notifications You must be signed in to change notification settings

Nikhil22/papoose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

papoose

What is it?

A function that pipes the results of one function to the next

Usage (node)

  1. Require the Papoose module
  2.   
      var papoose = require('papoose');
      
    
  3. Set up the functions that you wish to use (example)

  4.   
        function foo(a, b, c) {
          return a + b + c;
        }
    
        function bar(a) {
          return a * a;
        }
    
        function baz(a) {
          return a - 1;
        }
      
    
  5. Invoke pipe by passing in all your functions as arguments. Note: These functions execute in the order you pass them
  6.   
      var pipeFn = papoose.pipe(foo, bar, baz);
      
    
  7. Invoke the function returned from the step above by passing in the arguments you'd want to start off the pipe process with. Note: These arguments are used by the first function in the step above, and the result is piped to the subsequent function.
    pipeFn(1,2,3);

Usage (browser)

  1. Instantiate a Papoose object
  2.   
      var papoose = new Papoose();
      
    
  3. Set up the functions that you wish to use (example)

  4.     
        function foo(a, b, c) {
          return a + b + c;
        }
    
        function bar(a) {
          return a * a;
        }
    
        function baz(a) {
          return a - 1;
        }
        
      
  5. Invoke pipe by passing in all your functions as arguments. Note: These functions execute in the order you pass them
  6.     
        var pipeFn = papoose.pipe(foo, bar, baz);
        
      
  7. Invoke the function returned from the step above by passing in the arguments you'd want to start off the pipe process with. Note: These arguments are used by the first function in the step above, and the result is piped to the subsequent function.
    pipeFn(1,2,3);

About

This is a simple function that allows you to pipe the results of one function to a series of other functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published