Last active
November 2, 2017 09:33
-
-
Save sharmaabhinav/8dedf37af30ea4c2909e762697226481 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function head (arr) { | |
var [start, ...rest] = arr; | |
return start; | |
} | |
function tail (arr) { | |
var [start, ...rest] = arr; | |
return rest; | |
} | |
function pick (object, keys) { | |
var returnObj = {} | |
for(var i = 0;i<keys.length;i++) { | |
returnObj[keys[i]] = object[keys[i]] | |
} | |
return returnObj | |
} | |
function pipe (functions) { | |
return function (data) { | |
return functions.reduce(function (val, func) { | |
return func(val) | |
}, data) | |
} | |
} | |
const pipe = functions => data => functions.reduce((val, func) => func(val), data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment