Skip to content

Instantly share code, notes, and snippets.

View danielpetrov's full-sized avatar

Daniel Petrov danielpetrov

View GitHub Profile
import { addTickerForm } from '../../higherOrderComponents/addTickerForm'
console.log(addTickerForm)
var Monad = function(x) {
this.value = x
}
Monad.prototype.of = function(x) {
return new Container(x)
}
Monad.prototype.isNothing = function() {
return (this.__value === null || this.__value === undefined)
var Container = function(x) {
this.value = x
}
//not pointfree because we mention the data: word
const snakeCase = word => word.toLowerCase().replace(/\s+/ig, '_')
//pointfree
const snakeCase = compose(replace(/\s+/ig, '_'), toLowerCase)
const compose = () => {
const fns = arguments
return result => {
for (var i = fns.length - 1; i > -1; i--) {
result = fns[i].call(this, result)
}
return result
}
var input = [
{
title: "Batman Begins",
year: 2005,
cast: [
"Christian Bale",
"Michael Caine",
"Liam Neeson",
"Katie Holmes",
"Gary Oldman",
@danielpetrov
danielpetrov / function parameters
Created January 9, 2017 17:23
Functional programming demos
function foo(bar) {
}
function foo(bar) {
var _bar = bar
}
Planes