Rubico

[a]synchronous functional programming

README

rubico


[a]synchronous functional programming


  1. ```javascript [playground]
  2. const { pipe, map, filter } = rubico

  3. const isOdd = number => number % 2 == 1

  4. const asyncSquare = async number => number ** 2

  5. const numbers = [1, 2, 3, 4, 5]

  6. pipe(numbers, [
  7.   filter(isOdd),
  8.   map(asyncSquare),
  9.   console.log, // [1, 9, 25]
  10. ])
  11. ```

Installation


with npm
  1. ```bash
  2. npm i rubico
  3. ```

require rubico in CommonJS.
  1. ```javascript
  2. // import rubico core globally
  3. require('rubico/global')

  4. // import rubico core as rubico
  5. const rubico = require('rubico')

  6. // import an operator from rubico core
  7. const pipe = require('rubico/pipe')

  8. // import rubico/x as x
  9. const x = require('rubico/x')

  10. // import an operator from rubico/x
  11. const defaultsDeep = require('rubico/x/defaultsDeep')

  12. // import rubico's Transducer module
  13. const Transducer = require('rubico/Transducer')
  14. ```

import rubico in the browser.
  1. ```html [htmlmixed]
  2. <script src="https://unpkg.com/rubico/dist/global.min.js"></script>

  3. <script src="https://unpkg.com/rubico/dist/rubico.min.js"></script>

  4. <script src="https://unpkg.com/rubico/dist/pipe.min.js"></script>

  5. <script src="https://unpkg.com/rubico/dist/x/defaultsDeep.min.js"></script>