typia icon indicating copy to clipboard operation
typia copied to clipboard

Could be replace randexp with something else?

Open EloB opened this issue 1 year ago • 10 comments

Feature Request

The randexp seems like an unmaintained repo. It's using CJS that is bad for dead code elimination. Also has some old dependencies that also seems to be unmaintained. https://github.com/fent/randexp.js

Made a PR to try to add sideEffects: false to them without any response.

What do you think?

EloB avatar Jan 30 '24 12:01 EloB

Do you know something to recommend?

I also hope to change to another one. When complicate regular expression comes, randexp generates wrong string value which even cannot pass the RegExp.test(string) function of itself.

samchon avatar Jan 30 '24 15:01 samchon

Might give reregexp a shot. It does have limitations though.

Namchee avatar Feb 06 '24 02:02 Namchee

@samchon I never used such feature before. The only thing I would like is something that is ESM because it's better for dead code elimination.

EloB avatar Feb 06 '24 10:02 EloB

@EloB https://github.com/samchon/typia/pull/1099 This PR and v6.1 update may solve your issue.

samchon avatar Jun 12 '24 14:06 samchon

@samchon I think we still need to consider the alternative for randexp. Bundling is fine for now, but we need to find something.

So this issue still needs be opened!

ryoppippi avatar Jun 17 '24 21:06 ryoppippi

randexp is really great for bundle size, but reregep looks good

ryoppippi avatar Jun 17 '24 21:06 ryoppippi

I'm considering if magic-regexp implements zero-runtime random generator.

ryoppippi avatar Jun 17 '24 21:06 ryoppippi

  • https://github.com/fent/randexp.js - not maintained
  • https://github.com/arcanis/pxeger - not maintained
  • https://github.com/arh23/strgen-js - not maintained
  • https://github.com/suchjs/reregexp - unpopular It's all.

AlexRMU avatar Aug 07 '24 13:08 AlexRMU

See also: https://github.com/google/intermock https://github.com/faker-js/faker https://github.com/boo1ean/casual https://github.com/ngneat/falso https://github.com/g45t345rt/minifaker https://github.com/chancejs/chancejs https://github.com/w3tecch/typeorm-seeding https://github.com/json-schema-faker/json-schema-faker

AlexRMU avatar Aug 15 '24 17:08 AlexRMU

@AlexRMU Thank you for your investigation. We are finding a randome generator with these specs.

  • small bundle size
  • esm/cjs build
  • ability to generate random values from reliable regexes.

e.g. I found this library today copycat, but this cannot generate random string from regex

ryoppippi avatar Aug 15 '24 18:08 ryoppippi