Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-defined value generation #417

Closed
itstueben opened this issue Feb 8, 2024 · 5 comments
Closed

User-defined value generation #417

itstueben opened this issue Feb 8, 2024 · 5 comments

Comments

@itstueben
Copy link

How to generate user defined values

I'dont find how to add user definded values to the generator.
How can i add my own calue gerators some like faker.js?

Please help out.
Thx

@wdavidw
Copy link
Member

wdavidw commented Feb 8, 2024

With the column options, maybe this test will help you.

@itstueben
Copy link
Author

itstueben commented Feb 9, 2024

Thanks for the hint but it seems that is not support (anymore). The Typescript types are not supporting a function in the coulmuns array(see). I use the following code and get the message:

TypeError [ERR_INVALID_ARG_TYPE]: The "buf" argument must be an instance of Buffer, TypedArray, or DataView. Received an instance of Array

 generate({
        columns: [() => 'mydata'],
        encoding: 'utf-8',
        objectMode: true,
        length: args.count,
      }).pipe(process.stdout);

if i ignore typescript errors and use "objectMode:false" this will run as aspected.

@wdavidw
Copy link
Member

wdavidw commented Feb 9, 2024

Please reproduce and share a full sample with minimal code. I will enrich the tests and update the definition file accordingly.

@itstueben
Copy link
Author

i have a mini sample repo here

In the Typescript File the types are wrong. I hope this helps what is wrong with the types

@wdavidw
Copy link
Member

wdavidw commented Feb 27, 2024

Version 4.4.0 hopefully fixes your issue.

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

No branches or pull requests

2 participants