casual icon indicating copy to clipboard operation
casual copied to clipboard

populate() with custom generator returns "[object Object]"

Open jamesholcomb opened this issue 7 years ago • 2 comments

casual.define('mygen', function() {
    return {
        x: 1
    };
});

var result = casual.populate('{{mygen}}');

I thought it was a stringify issue, but it actually returns a string instead of an object. Am i missing something here?

jamesholcomb avatar Nov 24 '16 02:11 jamesholcomb

Hi, what exact output are you expecting in this example? populate just replaces placeholders with output of specified generator.

boo1ean avatar Nov 29 '16 11:11 boo1ean

I had assumed it would return"{x: 1}"

jamesholcomb avatar Nov 29 '16 14:11 jamesholcomb