cloudfour / core-hbs-helpers

Handlebars helpers that we usually need
MIT License
11 stars 2 forks source link

Refactor: Consolidate conditional helpers #12

Closed erikjung closed 9 years ago

erikjung commented 9 years ago

Closes #3

Summary

This new compare helper is modeled after the (identically named) helper found at https://github.com/assemble/handlebars-helpers/blob/master/lib/helpers/helpers-comparisons.js, and differs by using functions from the Ramda.js library. Why? In addition to reducing a bit of code on our end, I think there are (and will be) other opportunities to leverage the functional nature of Ramda (opposed to something like Underscore) in other helper functions.


CC @saralohr @nicolemors

tylersticka commented 9 years ago

Heh, now that I'm reading this, I guess && and || really aren't comparisons.

Assemble just keeps those as their own little helpers. Maybe they are unique, and I conflated them with ifEqual because of the similarity in naming convention.

erikjung commented 9 years ago

@tylersticka I'd be fine with either of these scenarios:

tylersticka commented 9 years ago

I like the first idea better but by a small margin. I'd be find with ifAnd and ifOr or even just and and or. (That's a confusing sentence.)

erikjung commented 9 years ago

@tylersticka Changes made, and PR description updated.

tylersticka commented 9 years ago

Yay! :clap: