Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use templating to generate rules #6

Open
MoOx opened this issue Dec 17, 2014 · 3 comments
Open

use templating to generate rules #6

MoOx opened this issue Dec 17, 2014 · 3 comments

Comments

@MoOx
Copy link
Member

MoOx commented Dec 17, 2014

Also create a 24 cols version.

poke @eramdam

@bloodyowl
Copy link
Contributor

I was about to open that issue 👍

@bloodyowl
Copy link
Contributor

I'm on it (already have the logic)

var _ = require("lodash")

/**
 * returns an array contaning arrays (groups of object) with index, total col
 * and value (%)
 *
 * @param {Array<Int>} columns
 * @returns Array<Array<Object>>
 */
function getSelectors(columns) {
  return _(columns)
    .map(function(col) {
      return _.range(1, col + 1).map(function(index){
        return {
          index : index,
          of : col,
          value : index / col
        }
      })
    })
    .flatten()
    .groupBy("value")
    .values()
    .valueOf()
}

but I can't find any elegant templating solution for it. any ideas @cssrecipes/owners?

@MoOx
Copy link
Member Author

MoOx commented Jan 2, 2015

Es6 template strings ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants