How to use the unique function from chance

Find comprehensive JavaScript chance.unique code examples handpicked from public code repositorys.

9
10
11
12
13
14
15
16
17
18
const Quote = require('APP/db/models/quote')
const Recording = require('APP/db/models/recording');

const numUsers = 196; // + 4 hardcoded real users = 200 total users
const numRecordings = 500;
const emails = chance.unique(chance.email, numUsers);
const questionsJSON = require('./seedData/questionsSeed');
const quotesJSON = require('./seedData/quotesSeed');
const recordingsJSON = require('./seedData/recordingsSeed');
const realUsers = require('./seedData/usersSeed');
fork icon3
star icon12
watch icon6

+ 3 other calls in file

39
40
41
42
43
44
45
46
47
48
const numOrderItems = 200
const numReviews = 300
const numCarts = 20
const numCartItems = 50

const emails = chance.unique(chance.email, numUsers)
let userIds = numUsers

//helper functions
function doTimes(n, fn) {
fork icon0
star icon1
watch icon1

7
8
9
10
11
12
13
14
15
16
17
18
19
var Story = require('./server/api/stories/story.model');


var numUsers = 100;
var numStories = 500;


var emails = chance.unique(chance.email, numUsers);


function doTimes (n, fn) {
  var results = [];
  while (n--) {
fork icon1
star icon0
watch icon0

+ 2 other calls in file

12
13
14
15
16
17
18
19
20
21
    while (days--) {
        timestamps.push(d.clone().subtract(days, 'days').format());
    }
}

const eventNames = Array.isArray(numberOfDifferentEvents) ? numberOfDifferentEvents : c.unique(c.name, numberOfDifferentEvents);

const segmentationKeysByName = eventNames.reduce((seg, name) => {
    seg[name] = c.unique(c.word, c.d6()).reduce((s, sk) => {
        s[sk] = c.unique(c.word, c.d4());
fork icon0
star icon0
watch icon0

+ 5 other calls in file