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

custom generators can break casual #66

Open
psalaets opened this issue May 1, 2017 · 4 comments
Open

custom generators can break casual #66

psalaets opened this issue May 1, 2017 · 4 comments

Comments

@psalaets
Copy link

psalaets commented May 1, 2017

Defining a custom generator with specific names can break other casual generators.

Example:

casual.define('letters', n => 'ABC');

// this built-in generator is now broken
casual.letter // => undefined

It only happens for me when custom generator named "letters" and it takes an argument.

@psalaets
Copy link
Author

psalaets commented May 1, 2017

I looked at the code and I think this is happening because the text provider has some helper properties that aren't part of the public api but they do get mixed into the casual object.

@psalaets
Copy link
Author

psalaets commented May 2, 2017

To resolve this we can change providers

+var privateHelper = 'blah';

var provider = {
- privateHelper: 'blah',

  builtInGenerator: function() {
-   return this.privateHelper;
+   return privateHelper;
  }
};

@AncientSwordRage
Copy link

Is there any movement on this?

@psalaets
Copy link
Author

psalaets commented Jun 19, 2020 via email

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