All Projects â†’ WaldoJeffers â†’ conductor

WaldoJeffers / conductor

Licence: MIT License
Mix both synchronous and asynchronous code without hassle

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to conductor

yona
Yona is a modern take on a dynamic general-purpose programming language with advanced functional programming, minimalistic ML-like syntax, strict evaluation, for GraalVM polyglot virtual machine (VM).
Stars: ✭ 113 (+94.83%)
Mutual labels:  asynchronous
RepositoryHelpers
📦 Extensions for HttpClient and Custom Repository based on dapper
Stars: ✭ 22 (-62.07%)
Mutual labels:  asynchronous
AutoOED
AutoOED: Automated Optimal Experimental Design Platform
Stars: ✭ 87 (+50%)
Mutual labels:  asynchronous
mogo
A collection of small DRY Go utilities to make life easier. DRY = Don't Repeat Yourself.
Stars: ✭ 19 (-67.24%)
Mutual labels:  utility-library
SockNet
The easiest and fastest way to work with sockets in C#
Stars: ✭ 42 (-27.59%)
Mutual labels:  asynchronous
su-downloader3
nodejs HTTP downloader with pause/resume support and segmented downloading
Stars: ✭ 14 (-75.86%)
Mutual labels:  utility-library
futures-async-stream
Async stream for Rust and the futures crate.
Stars: ✭ 141 (+143.1%)
Mutual labels:  asynchronous
python-logstash-async
Python logging handler for sending log events asynchronously to Logstash.
Stars: ✭ 141 (+143.1%)
Mutual labels:  asynchronous
memsocket
An asynchronous in-memory socket-like interface for Rust
Stars: ✭ 34 (-41.38%)
Mutual labels:  asynchronous
futura
Asynchronous Swift made easy. The project was made by Miquido. https://www.miquido.com/
Stars: ✭ 34 (-41.38%)
Mutual labels:  asynchronous
util
The util project, packed with common goodies.
Stars: ✭ 61 (+5.17%)
Mutual labels:  utility-library
firetrap
This project is no longer maintained. Check out the fork (lib)unFTP instead.
Stars: ✭ 15 (-74.14%)
Mutual labels:  asynchronous
envmnt
Environment variables utility functions.
Stars: ✭ 16 (-72.41%)
Mutual labels:  utility-library
postman-util-lib
🚀 A crypto utility library to be used from Postman Pre-request and Tests script tabs.
Stars: ✭ 42 (-27.59%)
Mutual labels:  utility-library
async-pidfd
Rust crate to use process file descriptors (pidfd) for Linux
Stars: ✭ 42 (-27.59%)
Mutual labels:  asynchronous
reactools
Create React interfaces is easy.
Stars: ✭ 14 (-75.86%)
Mutual labels:  asynchronous
RxRealm
Utilities for using RxJava with Realm
Stars: ✭ 23 (-60.34%)
Mutual labels:  utility-library
go-tools
A utility tool library of Golang.
Stars: ✭ 44 (-24.14%)
Mutual labels:  utility-library
AlephBFT
Rust implementation of Aleph consensus protocol
Stars: ✭ 17 (-70.69%)
Mutual labels:  asynchronous
drone-cortexm
ARM® Cortex®-M platform crate for Drone, an Embedded Operating System.
Stars: ✭ 31 (-46.55%)
Mutual labels:  asynchronous

Introduction

conductor

Conductor on npmjs Conductor download stats on npmjs Codeship Status for WaldoJeffers/conductor codecov

conductor is a modern utility library to help you control the execution flow using functional programming.

🤵 description

It provides a set of utility functions which can be used both with asynchronous and synchronous code, allowing you to control your execution flow very clearly and with a minimum of code. The library is designed in a functional programming spirit, to provide a coherent API and highly composable functions. Think of it as if Ramda & Async had a baby.

Read more on Why I'm building conductor.

🔧 installation

npm install conductor

✨ examples

Here are a few examples of what you can do with conductor.

use asynchronous functions seamlessly

import { map } from 'conductor'

const fetchCharacter = id => fetch(`https://swapi.co/api/people/${id}`).then(res => res.json())
const character_ids = [1, 2, 3]
await map(fetchCharacter, character_ids) // [{id: 1, name: 'Luke'}, ...]

You can use map with an asynchronous mapper and directly use the await keyword. No need to use Promise.all like you need to with Array.prototype.map or lodash.map.

compose things

import { compose, get } from 'conductor'

const character_id = 1
const fetchCharacter = id => fetch(`https://swapi.co/api/people/${id}`).then(res => res.json())
const fetchPlanet = url => fetch(url).then(res => res.json())
const getHomeworldName = compose(get('name'), fetchPlanet, get('homeworld'), fetchCharacter)

await getHomeworldName(character_id) // Tatooine

You can compose functions seamlessly, without ever wondering if you need to use Promise.prototype.then because one function returns a Promise. Simply add await before compose if one your functions is asynchronous.

functional by design

import { compose, equals, get, join, map, filter } from 'conductor'

const jedis = [
  { name: 'Luke', side: 'light' },
  { name: 'Yoda', side: 'light' },
  { name: 'Darth Vader', side: 'dark' },
]
const isGood = filter(compose(equals('light'), get('side')))
const getName = map(get('name'))
const concat = join(', ')

compose(concat, getName, isGood)(jedis) // 'Luke, Yoda'

All functions in conductor are curried by default, which means they can be used in a partially applied form to define very modular and composable blocks in your code. In the example above, we have an array of jedis, and we want to retrieve a concatenated string of all the good guys' name. We first define an isGood function, which will filter out the bad guys. Then, we create a mapping functiongetNamewhich will retrieve each jedi's name. Finally, we create a concatenating function called concat. We can now easily compose them and pass thejedis array to the resulting function. Notice how we created small & modular point-free functions, and only passed the input data when we actually needed to.

📖 documentation

🗿 influences

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].