Created
January 3, 2018 03:21
-
-
Save adatta02/844f8bba342d4448a3ccf88e3d95054c to your computer and use it in GitHub Desktop.
This file contains 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 partial(fn /*, rest args */){ | |
const newArgs = Array.apply(null, arguments).slice(1); | |
return function(){ | |
const fnArgs = newArgs.concat(Array.apply(null, arguments)); | |
fn.apply(null, fnArgs); | |
} | |
} | |
const Logger = { | |
log(level, dateFormat, msg) { | |
console.log(level, dateFormat, msg); | |
} | |
}; | |
const info = partial(Logger.log, "info", "ISO8601"); | |
info("Application started"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment