Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacopkane/functional-programming-jargon-for-javascripters
WIP - Unscientific and Friendly Dummy Explanations of FP Jargons
https://github.com/jacopkane/functional-programming-jargon-for-javascripters
Last synced: 21 days ago
JSON representation
WIP - Unscientific and Friendly Dummy Explanations of FP Jargons
- Host: GitHub
- URL: https://github.com/jacopkane/functional-programming-jargon-for-javascripters
- Owner: JacopKane
- License: apache-2.0
- Created: 2018-01-08T16:46:28.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-08T19:15:04.000Z (about 7 years ago)
- Last Synced: 2024-11-16T06:43:02.817Z (about 2 months ago)
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Functional Programming Jargon for JavaScripters
Unscientific and (Maybe) More Friendly Dummy Explanations of FP Jargons## Immutability
You simple don't change the current variables (including their nested data) and
the data you've got defined.There there are many different ways to achieve and apply this with different
benefits.You should start googling `immutable-js`, `redux`, `ramda` after checking this
vanilla JavaScript example:```javascript
const data = {
irrelavent: 'data',
aPropDefinedByAnotherDev: 'dummy'
}// mutable way
// another dev irresponsibly decides to change this
// without knowing whether he or she if this data
// affects somewhere else:
data['aPropDefinedByAnotherDev'] = 'yolo'//immutable way
const newData = { ...data, aPropDefinedByAnotherDev: 'yolo' }
// or:
const newData = Object.assign({}, data, { aPropDefinedByAnotherDev: 'yolo' })
// (note the first empty object so we don't touch
// existing variables)
```### Benefits
*Todo...*Huge.
## Lenses
Getter and setter functions for your data
```javascript
const adelle = { so: { deep: { roll : { in : 'it' } } } }// imperative way
const theDeepData = adelle.so.deep.roll.in.it// through lens
import { lensProp, compose } from 'ramda'//atomic selectors (lenses)
const [so, deep, roll, in , it] = ['so', 'deep','roll','in','it']
.map(lensProp)export soDeepSelector = compose(so, deep, roll, in , it)
```
### Benefits
aids immutability, composoble functions without defining and
exporting variables there and there. You can share these
functions and re-use later. Which for example helps sharing
of data path definitions between universal server and client
for an API.