Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function insertPost(params, models, categories, tags) {
// get author // 1 or 2
const randomAuthorId = Math.floor(Math.random() * (2 - 1 + 1)) + 1;
let admin = await models.Author.findOne({ where: { id: randomAuthorId } });
const slug = params.title.toLocaleLowerCase().replace(/ /g, "-");
let post = await models.Post.create({
title: Faker.company.catchPhrase(),
body: generatePost(),
excerpt: Faker.lorem.sentences(4),
cover_image: params.cover_image,
authorId: randomAuthorId,
type: params.type,
status: params.status,
slug: slug,
createdAt: new Date(),
publishedAt: new Date(),
});
const randomCategory = Math.floor(Math.random() * (2 - 1 + 1)) + 1;
return Promise.all([
admin.addPost(post),
post.addTaxonomy(categories[randomCategory]),
completed.complete()
}
}
// Now set up the renderer, and process
const renderer = writeToFile
antares.addRenderer(writeToFile, {
name: "fileWriter",
xform
})
for (let i = 0; i < count; i++) {
antares.process({
type: "writeIt",
payload: {
text: faker.company.catchPhrase()
},
meta: { index: i }
})
}
// Force jest to wait for us!
return completed.toPromise()
}
return [...new Array(64)].map(_ => ({
date: startDay.add(4, 'hours').clone(),
title: faker.company.companyName(),
description: faker.lorem.sentence(),
// use random dimensions to get random urls
image: faker.image.nightlife(Math.floor(Math.random() * 200) + 100, Math.floor(Math.random() * 200) + 100),
}));
})();
beforeEach(() => {
formData = {
invoiceID: 'Invoice: 123-456-789',
recipient: {
newRecipient: true,
select: {
id: uuidv4(),
fullname: faker.name.findName(),
email: faker.internet.email(),
company: faker.company.companyName(),
phone: faker.phone.phoneNumber(),
},
new: {
fullname: faker.name.findName(),
email: faker.internet.email(),
},
},
rows: [
{
id: uuidv4(),
description: faker.commerce.productName(),
price: faker.commerce.price(),
quantity: faker.random.number(100),
},
{
id: uuidv4(),
const generateCommunity = () => {
const name = faker.company.companyName();
return {
id: uuid(),
createdAt: faker.date.past(2),
name,
description: casual.short_description(),
website: faker.internet.url(),
profilePhoto: faker.image.business(),
coverPhoto: faker.image.image(),
slug: slugify(name),
};
};
const getRandomRow = () => {
return {
avatar: faker.image.avatar(),
name: faker.name.findName(),
city: faker.address.city(),
email: faker.internet.email(),
company: faker.company.companyName()
};
};
.map((_, i): RemoteBookmark => ({
id: i,
metadata: faker.company.companyName(),
desc: faker.company.bs(),
url: faker.internet.url(),
tags: ',' + [...new Set(Array(Math.floor(Math.random() * 5))
.fill(undefined)
.map(() => faker.random.word()))].join(',') + ',',
flags: 0,
}));
createFakeRowObjectData(/*number*/ index) /*object*/ {
return {
id : index,
avatar : faker.image.avatar(),
city : faker.address.city(),
email : faker.internet.email(),
firstName : faker.name.firstName(),
lastName : faker.name.lastName(),
street : faker.address.streetName(),
zipCode : faker.address.zipCode(),
date : faker.date.past(),
bs : faker.company.bs(),
catchPhrase : faker.company.catchPhrase(),
companyName : faker.company.companyName(),
words : faker.lorem.words(),
sentence : faker.lorem.sentence(),
};
}
import React, { useState } from 'react';
import { withKnobs } from '@storybook/addon-knobs';
import { Menu, Icon, Button, Avatar } from 'antd';
const { SubMenu } = Menu;
import faker from 'faker';
const items = [{ avatar: faker.image.avatar(),name: faker.company.companyName() },
{ avatar: faker.image.avatar(),name: faker.company.companyName() },
{ avatar: faker.image.avatar(),name: faker.company.companyName() },
{ avatar: faker.image.avatar(),name: faker.company.companyName() },
{ avatar: faker.image.avatar(),name: faker.company.companyName() },
{ avatar: faker.image.avatar(),name: faker.company.companyName() },
{ avatar: faker.image.avatar(),name: faker.company.companyName() }];
const renderMenu = items.map((d, index) =>
<span>{d.name}</span>
);
class App extends React.Component {
state = {
collapsed: false
};
toggleCollapsed = () => {
this.setState({