Skip to content

Allow recursive variable expansion#7

Open
shawrkbait wants to merge 2 commits intokylestetz:masterfrom
shawrkbait:master
Open

Allow recursive variable expansion#7
shawrkbait wants to merge 2 commits intokylestetz:masterfrom
shawrkbait:master

Conversation

@shawrkbait
Copy link

This change allows recursive variable expansion.

For example: we can choose from a list of questions:

var Sentencer = require('sentencer');
var randy = require('randy');

var questions = ["what is {{ a_noun }}", "why is {{ a_noun }} so {{ adjective }}"];

Sentencer.configure({
  actions: {
    question: function() {
      return randy.choice(questions);
    }
  }
});

console.log( Sentencer.make("Question 1: {{ question }}");

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant