Open Errorname opened 5 years ago
I'm trying to integrate google-mustaches into a Pipedream workflow. Here is my code :
async (event, steps, params, auths) => {
import Mustaches from 'google-docs-mustaches'
const mustaches = new Mustaches({
token: () => auths.google_drive.access_token
})
mustaches.interpolate({
source: params.docId,
destination: params.folderId,
data: {
firstname: 'Thibaud',
lastname: 'Courtoison',
accounts: [{ money: 1500 }]
}
})
}
I have the folling error TypeError: Mustaches is not a constructor
. When creating workflows, I usually use require(...)
instead of standard imports.
How can I bypass the problem ? Thanks
EDIT: Regarding this topic, you must add module.export = Mustaches
somewhere in you code, so I can use it like this:
const Mustaches = require('google-docs-mustaches')
EDIT2: I have found the solution:
const Mustaches = require('google-docs-mustaches').default;
Maybe you should mentionned this tip in the README.md
Hi!
Do you use google-docs-mustaches in your project? Great! Let me know what you liked and disliked, what features you would love to have, and how you use it!
Thanks!🙏