How to use the faker.hacker function in faker

To help you get started, we’ve selected a few faker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flikore / writerstrail / scripts / sample-generator.js View on Github external
var promises = [];

    while (today.isAfter(yearAgo)) {
      var amount = faker.random.number(6); // between 0 and 5

      for (var i = 0; i < amount; i++) {
        var project = selectProject(),
            wpm = (Math.random() * wpmRange[1]) + wpmRange[0],
            duration = (Math.random() * durationRange[1]) + durationRange[0],
            wordcount = Math.min(Math.floor(wpm * (duration / 60)), project.totalWordcount),
            charcount = calcCharcount(wordcount);

        project.totalWordcount -= wordcount;

        promises.push(models.Session.create({
          summary: faker.hacker.phrase(),
          start: randomTime(today).toDate(),
          duration: duration,
          pausedTime: randomIntBetween(0, Math.floor(duration / 6)),
          wordcount: wordcount,
          charcount: charcount,
          projectId: project.id,
          isCountdown: !!faker.random.number(),
          zoneOffset: today.utcOffset()
        }));
      }

      today.subtract(1, 'day');
    }

    return promise.all(promises);
  });
github revskill10 / next-template / modules / core / data / mocks / calendar.js View on Github external
title: faker.name.firstName(),
      rightTitle: faker.name.lastName(),
      bgColor: randomColor({ luminosity: 'light', seed: randomSeed + i })
    })
  }

  let items = []
  for (let i = 0; i < itemCount; i++) {
    const startDate = faker.date.recent(daysInPast).valueOf() + (daysInPast * 0.3) * 86400 * 1000
    const startValue = Math.floor(moment(startDate).valueOf() / 10000000) * 10000000
    const endValue = moment(startDate + faker.random.number({ min: 2, max: 20 }) * 15 * 60 * 1000).valueOf()

    items.push({
      id: i + '',
      group: faker.random.number({ min: 1, max: groups.length }) + '',
      title: faker.hacker.phrase(),
      start: startValue,
      end: endValue,
      // canMove: startValue > new Date().getTime(),
      // canResize: startValue > new Date().getTime() ? (endValue > new Date().getTime() ? 'both' : 'left') : (endValue > new Date().getTime() ? 'right' : false),
      className: (moment(startDate).day() === 6 || moment(startDate).day() === 0) ? 'item-weekend' : '',
      itemProps: {
        'data-tip': faker.hacker.phrase()
      }
    })
  }

  items = items.sort((a, b) => b - a)

  return { groups, items }
}
github microsoft / fluent-ui-react / test / specs / commonTests.js View on Github external
it('renders child text', () => {
    assertRequired(Component, 'a `Component`')

    const text = faker.hacker.phrase()
    shallow(createElement(Component, requiredProps, text))
      .should.contain.text(text)
  })
github ezy / seedpress-cms / seeders / terms.js View on Github external
const faker = require('faker');
const changeCase = require('change-case');

let termList = [];

for (let i = 0; i < 6; i++) {
  const name = faker.hacker.noun();
  const type = faker.hacker.noun();
  const termObj = {
    id: faker.random.number(100000),
    termType: type,
    termName: name,
    termSlug: `${changeCase.paramCase(type)}-${changeCase.paramCase(name)}`,
    createdAt: new Date(),
    updatedAt: new Date()
  };
  termList.push(termObj);
}

module.exports = {
  up: async (queryInterface) => {
    await queryInterface.bulkInsert('Terms', termList, {});
  },
github neoteric-eu / nestjs-auth / src / app / home / home.service.ts View on Github external
const savedHomes = await this.saveAll([home]);

			const medias = [];

			for (let i = 2; i < 6; ++i) {
				if (!row[i]) {
					continue;
				}

				medias.push({
					homeId: savedHomes[0].id.toString(),
					originalname: faker.system.commonFileName('jpeg'),
					mimetype: 'image/fake',
					size: faker.random.number({min: 86400, max: 259200}),
					url: row[i],
					type: faker.hacker.noun(),
					order: i,
					caption: faker.random.word(),
					isDeleted: false,
					createdAt: DateTime.utc().toString(),
					updatedAt: DateTime.utc().toString()
				});
			}

			return [home, ...medias];
		} catch (e) {
			this.logger.debug(`address1, address2: ${address1}, ${address2}`);
			this.logger.error(e.message, e.stack);
			return [null, null];
		}
	}
}
github connect-foundation / 2019-21 / backend / DB / dummy / hashTagDummies.js View on Github external
export default function makeHashTagDummy(number = 100) {
	const bulkHashTag = [];

	for (let i = 0; i < number; ++i) {
		const name = faker.hacker.ingverb();
		const createdAt = faker.date.past(1);
		const updatedAt = createdAt;
		const EventId = faker.random.number({min: 1, max: EVENT_NUM});

		bulkHashTag.push({name, createdAt, updatedAt, EventId});
	}
	return bulkHashTag;
}
github kingdido999 / atogatari / server / src / scripts / seed.js View on Github external
function createRandomWords(count) {
  const tags = []

  for (let i = 0; i < count; i++) {
    tags.push(faker.hacker.noun())
  }

  return uniq(tags)
}
github letterpad / letterpad / api / seed / contentGenerator.js View on Github external
const generateQuote = () => {
  return `<section>${generateSentence()}</section><section><blockquote>${Faker.hacker.phrase()}</blockquote><p></p><p>${generateSentence()}</p></section>`;
};
github epochtalk / treedb / examples / helper.js View on Github external
exp.genPost = function() {
  var post = {
    title: faker.hacker.adjective() + ' ' + faker.hacker.noun(),
    body: faker.lorem.paragraph(),
    created_at: faker.date.future().getTime()
  };
  return post;
};
github birkir / react-native-appstore / scripts / seed.js View on Github external
const generateStory = (apps = []) => ({
  backgroundColor: `${faker.internet.color()}`,
  date: faker.date.recent(10),
  imageUrl: faker.image.imageUrl(),
  legend: `${faker.hacker.ingverb()} ${faker.hacker.noun()}`,
  title: faker.hacker.phrase(),
  displayType: 'DEFAULT',
  ...faker.random.arrayElement([
    {},
    {},
    { app: faker.random.arrayElement(apps) },
    { apps: sampleSize(apps, 5 + faker.random.number(5)) },
  ]),
});