Skip to content

Instantly share code, notes, and snippets.

@idettman
Last active November 25, 2017 19:48
Show Gist options
  • Select an option

  • Save idettman/eb042db0945bb1fddd9f to your computer and use it in GitHub Desktop.

Select an option

Save idettman/eb042db0945bb1fddd9f to your computer and use it in GitHub Desktop.
JavaScript maybe
function maybe(fn) {
let i = 0, length = 0
return function () {
length = arguments.length
if (length) {
for (i = 0; i < length; ++i) {
if (!arguments[i]) {
return;
}
}
return fn.apply(this, arguments);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment