Skip to content

Instantly share code, notes, and snippets.

@cuipengfei
Last active December 31, 2015 09:49
Show Gist options
  • Save cuipengfei/7969190 to your computer and use it in GitHub Desktop.
Save cuipengfei/7969190 to your computer and use it in GitHub Desktop.
functional js partial application
module.exports = function(namespace) {
return console.log.bind(console, namespace)
}
var slice = Array.prototype.slice
function logger(namespace) {
return function () {
console.log.apply(null, [namespace].concat(slice.call(arguments)))
}
}
module.exports = logger
var slice = Array.prototype.slice
function logger(namespace) {
return function() {
console.log.apply(console, [namespace].concat(slice.call(arguments)))
}
}
module.exports = logger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment