FreeAllMedia / stimpak

An easy-to-use system for defining, discovering, and re-using code, text, and workflow patterns
http://stimpak.io
MIT License
8 stars 1 forks source link

Stimpak.cast feature #29

Closed warang580 closed 8 years ago

dcrockwell commented 8 years ago

Very nice, I left a couple of formatting consideration notes

dcrockwell commented 8 years ago

There's an extra scenario as well which needs a test to cover off on it (note there is no .prompt):

instead of this, you can do:

stimpak
.destination(process.cwd())
.answers({
    "casted": "5",
    "untouched": "5"
})
.cast(answer => parseInt(answer))
.generate(error => {
    stimpak.answers().casted.should.eql(5);
    stimpak.answers().untouched.should.eql("5");
});
warang580 commented 8 years ago

I've added the test and cleaned the indentation with tabs only.

Just one question, what is the expected behaviour when doing this :

stimpak
  .cast(answer => parseInt(answer))
  .prompt(promptOne)
  .prompt(promptTwo)

Are promptTwo answers (and also following prompts answers) also casted ? Or is it just the first .prompt() after .cast() ?

dcrockwell commented 8 years ago

Just one question, what is the expected behaviour when doing this :

For now, I imagine the .cast working on all subsequent prompts, but in the future we could make it per-prompt