Skip to content

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