Added createBehavior.js
Hey up,
Here's my PR for the createBehavior
helper. This has been dog-fed by my current project, and I've recently been able to generalise the code.
Documentation for createBehavior is here: https://code.area17.com/a17/a17-helpers/wikis/createbehavior
Since the initial discussion last month, I've added "sub-behaviors" and "mixins", and done some work to battletest the code, including tests.
As this is my first PR, there's probably some workflow stuff I'm unaware of, such as version bumping, or linting?
. . .
It also includes two auxiliary helpers, which I thought would be useful as their own helpers:
addDirectionsToBreakpoint(breakpointConfig/* :Object */)
Converts a breakpoint config of e.g. {small: { start: null, end: 999 }, large: { start: 1000, end: null }}
to include the small+
and large-
variants.
getMediaQueryFromBreakpoint(breakpointAlias/* :string */, breakpointConfig /* :Object */)
Converts a breakpoint alias to an actual media query.
cc @mike