Skip to content

Instantly share code, notes, and snippets.

@lsmoura
Created December 22, 2017 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsmoura/0446cb48aad0c768e022ac4018f07c8e to your computer and use it in GitHub Desktop.
Save lsmoura/0446cb48aad0c768e022ac4018f07c8e to your computer and use it in GitHub Desktop.
// Returns true if *all* parameters are true
const all = (...args) => (
args.reduce(
(answer, current) => answer && current,
true
)
);
// Returns true if *any* of the parameters is true
const any = (...args) => (
args.reduce(
(answer, current) => answer || current,
false
)
);
// Returns false if *none* of the parameters is true
const none = (...args) => (
args.reduce(
(answer, current) => answer && !current,
true
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment