open-index/open-npm huggingface dataset:
npm package: @sidefx/core
Description: interface for purely functional code
Author: thelambdaparty
Latest version: 0.3.0

**TODO**

- [ ] Coverage reporting - [coveralls](https://coveralls.io/)
- [ ] Commit message validation - [validate-commit-msg](https://github.com/kentcdodds/validate-commit-msg)
- [ ] Semantic release - [sematic-release](https://github.com/semantic-release/semantic-release)

---

<p align="center">
  <img src="https://raw.githubusercontent.com/thelambdaparty/thelambdaparty.github.io/master/others/sidefx-readme.png" />
  <br/>
  
  <img src="https://img.shields.io/travis/sidefxjs/core.svg?style=flat-square" />
  <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" />
  <img src="https://img.shields.io/badge/documentation--blue.svg?style=flat-square" /> 
  <br/>
  <code>npm install @sidefx/core --save</code>
  <br/>
  <code>https://unpkg.com/@sidefx/core</code>
</p>

---

```js
// SideFx is a minimal interface to make development 
// with purely functional code easier and testable

import {fx, inject} from '@sidefx/core'

// declare custom effects.
// must returns a function
const mySideEffect = (value) => {
  const effect = () => {
    global.crazySideEffects(value)
    console.log(`Hello ${value}`)
  }
  effect.value = value
  return effect
}

// define injections, DRY
inject({ myState: '!'  })

// then code with pure functions.
// injections passed as first parameter
const myFunction = fx(({ myState }, value) => {
  return [ mySideEffect(value + myState) ]
})

// get returned values without
// executing the side effects
console.log(myFunction.pure('Mars'))
// -> [function effect()]
console.log(myFunction.pure('Mars')[0].value)
// -> 'Mars!'

// or just run the function
// to execute the side effects
myFunction('Earth')
// -> 'Hello Earth!'
```