当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript lorem.sentence方法代码示例

本文整理汇总了TypeScript中faker.lorem.sentence方法的典型用法代码示例。如果您正苦于以下问题:TypeScript lorem.sentence方法的具体用法?TypeScript lorem.sentence怎么用?TypeScript lorem.sentence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在faker.lorem的用法示例。


在下文中一共展示了lorem.sentence方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: makeNodes

function makeNodes(n: number = defaultN) {
  const values: any[] = []

  for (let i = 0; i < n; i++) {
    values.push({
      _typeName: 'Post',
      id: String(start + i),
      title: faker.lorem.sentence(),
      description: faker.lorem.paragraphs(),
      state: 'Published',
    })
  }
  for (let i = 0; i < n; i++) {
    values.push({
      _typeName: 'Comment',
      id: String(start + n + i),
      text: faker.lorem.sentence(),
    })
  }

  return {
    valueType: 'nodes',
    values,
  }
}
开发者ID:ahmb84,项目名称:prisma,代码行数:25,代码来源:makeData.ts

示例2:

const createMessage = (channelId) => {
  return {
    id: faker.random.uuid(),
    content: faker.lorem.sentence(),
    creationTime: faker.date.past().getTime().toString(),
    author: {
      name: faker.name.firstName() + '.' + faker.name.lastName(),
      avatar: faker.image.avatar(),
    },
    channel: { id: channelId },
  };
};
开发者ID:RocketChat,项目名称:Rocket.Chat.PWA,代码行数:12,代码来源:mocks.ts

示例3: getFakerData

 /**
  * Use faker to generate metadata for the inputs
  * @param {type} 
  * the type of input to generate metadata for
  */
 getFakerData(type): any {
     switch (type) {
         case 'string':
             return faker.lorem.sentence();
         case 'boolean':
             return Math.random() > 0.5;
         case 'sentence':
             return faker.lorem.sentence();
         case 'image':
             let width = Math.floor(Math.random() * (500 - 300 + 1) + 300);
             let height = Math.floor(Math.random() * (300 - 250 + 1) + 300);
             return faker.image.imageUrl(width, height);
         case 'avatar':
             return faker.image.avatar();
         case 'words':
             return faker.lorem.words();
         case 'phone':
             return faker.phone.phoneNumber();
         case 'name':
             return faker.name.findName();
         default:
             return null;
     }
 }
开发者ID:joaogarin,项目名称:carte-blanche-angular2,代码行数:29,代码来源:fakerDataGenerator.service.ts

示例4: createFakeRowObjectData

 createFakeRowObjectData(index: number): Object {
   return {
     id: index,
     avartar: 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(),
   };
 }
开发者ID:Rigg802,项目名称:SampleApp,代码行数:18,代码来源:faker.ts

示例5: initDb

/** Create the database. */
async function initDb() {

    // Creates the file.
    try {
        await sequelize.authenticate();
        console.log('Connection to the database successful.');
    } catch (error) {
        console.log(`Error while trying to connect to the database: ${error}`);
    }

    // Syncs the model
    try {
        await sequelize.sync({force: true});
        console.log('Database sync sucessful');
    } catch (error) {
        console.log(`Error while trying to sync the model with the database : ${error}`);
    }

    if (process.env.DB_ENV !== 'prod') {
        // Populate the database with fake data
        try {
            let data: IArticle[] = [];
            for (let i = 0; i < 10; i++) {
                data.push({
                    title: faker.commerce.department(),
                    description: faker.lorem.sentence(),
                    content: faker.lorem.sentences(),
                    published: faker.random.boolean(),
                    publishedAt: new Date().toISOString()
                });
            }
            await Article.bulkCreate(data);
            console.log('10 articles successfully inserted.');
        } catch (error) {
            console.log(`Error while trying to insert an article in the database : ${error}`);
        }
    }
}
开发者ID:get-focus,项目名称:focus-help-center,代码行数:39,代码来源:init.ts

示例6: beforeEach

 beforeEach((done: Function) => {
     error = new Error(faker.lorem.sentence());
     daoStub.returns(Promise.reject(error));
     AuthController.register(request, response, next)
         .then(() => done());
 });
开发者ID:BCotrim,项目名称:chocobo-api,代码行数:6,代码来源:auth.controller.spec.ts

示例7: insertCard

        cards.splice(index, 1);
    });
}

export function insertCard(board: KanbanBoard, card: Card, listId: number, index: number) {
    return updateCards(board, listId, cards => {
        cards.splice(index, 0, card);
    });
}

export const initialBoard: KanbanBoard = [
    {
        id: 0,
        title: "To Do",
        cards: [
            { id: 1, title: faker.lorem.sentence() },
            { id: 2, title: faker.lorem.sentence() },
            { id: 3, title: faker.lorem.sentence() },
            { id: 4, title: faker.lorem.sentence() },
            { id: 5, title: "This card is a bigger than the other ones. "
                + faker.lorem.sentence() + " " + faker.lorem.sentence() }
        ]
    },
    {
        id: 1,
        title: "Doing",
        cards: [
            { id: 6, title: faker.company.bs() },
            { id: 7, title: faker.company.bs() },
            { id: 8, title: faker.company.bs() },
            { id: 9, title: faker.company.bs() },
开发者ID:fossabot,项目名称:angular-skyhook,代码行数:31,代码来源:lists.ts

示例8: addFakeUsers

	async addFakeUsers(count: number = 20) {
		let i = count;

		while (i--) {

			try {
				let password = faker.internet.password();

				const { user, channel } = await userController.create({ id: null }, {
					_id: undefined,
					name: faker.name.findName(),
					email: faker.internet.email(),
					country: faker.address.countryCode(),
					password: password,
					profileImg: faker.image.avatar(),
					description: faker.lorem.sentence()
				});

				console.log(i, 'user-id:', user._id, ' channel-id:', channel._id);

			} catch (error) {
				console.error('USER ERROR', error);
			}
		}

		process.exit();
	},

	async checkUser(id: string) {
		const user = await userController.findById({ id }, id);
		const channel = await channelController.findById({ id }, id);
开发者ID:Chegeek,项目名称:TradeJS,代码行数:31,代码来源:user.tools.ts


注:本文中的faker.lorem.sentence方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。