Skip to content

Instantly share code, notes, and snippets.

@kevinkace
Created May 16, 2018 17:18
Show Gist options
  • Save kevinkace/183824f93ddbdc69f95961297f55f0a6 to your computer and use it in GitHub Desktop.
Save kevinkace/183824f93ddbdc69f95961297f55f0a6 to your computer and use it in GitHub Desktop.

Attrs

  • Write a function to process an array of objects, running a function on each object based on it's attributes.
  • Each object can have up to 3 attributes, a, b, c
  • Each attribute can have a value of 0-2
  • The function called on each object is based on truthy attributes, eg:
    • obj = { a : 2, b : 1 } would run ab() (or ba(), name doesn't matter)
    • obj = { c : 1 } would run c()
  • The processing fns (a(), b(), etc) are provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment