question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request]: export an instantiated chance object

See original GitHub issue

Current Behavior

Currently we have a lot of boilerplate code and a lot of instantiated chance objects in our test files:

import Chance from 'chance';

const chance = new Chance();

Expected Behavior

Provide an instantiated chance object to consumer:

import {chance} from 'chance';

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
TheLarkInncommented, Jun 23, 2018

HI! I haven’t quite been sure if I want to submit the PR yet for fix some tests, but would something like this work?

https://github.com/chancejs/chancejs/compare/master...TheLarkInn:feature/rewrite-to-modules?expand=1

See the test changes.

0reactions
victorquinncommented, Jun 27, 2018

Sorry for the long response, but generally I always envisioned making this the default in 2.x which I also hoped to pair with the code splitting which it seem like may be implemented in @TheLarkInn 's change though I haven’t had time to dig into it in depth yet.

But I’ve always regretted returning the constructor and expecting folks to instantiate it. While that has its upsides (flexibility of seed), it comes with a lot of downsides (PITA having to instantiate which is counter-intuitive and not the way most node modules function in 2018).

Anyway, tentatively feeling good about it, but want to make sure it isn’t a significant breaking change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node Module Exports Explained - freeCodeCamp
The above object basically describes an encapsulated module from a JS file with module.exports being the exported component of any types - ...
Read more >
Object Schema Export in Insight Cloud - Atlassian Community
Hi Martin, There is a feature request suggesting implementing this feature on the Cloud version: export all device from insight cloud.
Read more >
"export var" for custom types/classes #359 - GitHub
This feature looks logical and it provides the possibility to edit exported custom class variables via the inspector.
Read more >
Page-Specific Export - Feature Request? - Ideas - Bootstrap Studio ...
Hi, I am converting / rewriting a website using Bootstrap Studio. The site currently has about 30 pages and is growing. As a...
Read more >
Exporting data to a JSON, CSV, or XML file - Zendesk help
If you do not have this feature, contact Zendesk Customer Support to ... For CSV or XML exports, click Request file beside the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found