Questions tagged [chancejs]

For questions involving the chance.js JavaScript library. Include the [javascript] tag, too.

Chance is a JavaScript library for generating random strings, numbers, dates, including many predefined domains such as ages, birthdays, animals, emails, addresses, GUIDs, ...etc.

chancejs.com

8 questions
2
votes
1 answer

Importing Chance JS library in Vue.js

I have 2 views for adding data to a database, one for songs and one for genres. However, I want to populate the input fields with random data, but I don't know why importing chance in genres, but not in songs, makes songs working, but not genres…
2
votes
1 answer

How to use Chance js in Vue project?

I can't get Chance js to work in my vue project. I install and import it locally and it give this error when I try to access chance.paragraph() in the .vue file. __WEBPACK_IMPORTED_MODULE_0_chance___default.a.paragraph is not a function" Running…
1
vote
1 answer

unable to load and eval javascript code in postman pre-request

I am trying to load external javascript in the pre-request tab of postman request by following the steps mentioned in https://blog.postman.com/adding-external-libraries-in-postman/ but seems like it is not working. Below is the code I am trying and…
Venu
  • 1,513
  • 3
  • 19
  • 37
1
vote
0 answers

Dice value returns undefined JavaScript

I'm trying to code a dice roller function for my Discord Bot, and I'm using a library called chance.js, and when I try to roll a normal dice (example 1d8, 1d20, 1d100) it works, but I want to add a feature that if I write the amount to sum up to the…
clapmemereview
  • 371
  • 1
  • 4
  • 14
0
votes
1 answer

Cypress - Use Chance JS to generate Data and store that Data for use later

Essentially what I want to do is generate a name using ChanceJS for a test case within cypress, but in a separate file / test case I want to be able to recall that name that I generated earlier so I can select it / check it exists. I have cut down…
0
votes
2 answers

Javascript - avoid duplicated questions into an array

I have this snippet in my class that use chance.js to generate a random number: this.askQuestions = []; this.questions = JSON.parse(this.questionsData); for(let i = 0; i < 10; i++){ let n = chance.integer({min: 0, max:…
newbiedev
  • 2,607
  • 3
  • 17
  • 65
0
votes
2 answers

How to import chance from chancejs in angular?

I have installed chancejs using the command below: npm install chance I have created an angular 10 project and cannot find any chance.js library added. When I try to use the chance methods such as chance.string() in the file…
avdeveloper
  • 449
  • 6
  • 30
0
votes
1 answer

How to generate 100 unique 10-char strings with chance.js

I want to generate 100 unique 10-char strings using chance.js. I use the code below, but it returns an error. Anyone knows how to make it work? let res = chance.unique(chance.string({ length: 10, casing: 'upper', alpha: true, numeric: true }),…
Test
  • 41
  • 4