本文整理汇总了TypeScript中faker.random类的典型用法代码示例。如果您正苦于以下问题:TypeScript random类的具体用法?TypeScript random怎么用?TypeScript random使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了random类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: authenticated
sendMessage: authenticated(AccountsServer, (root, { channelId, content }, {user}) => {
const messagesArray = messages.get(channelId);
if (!messagesArray) {
console.error('channel not found');
return null;
}
const newMessage = {
id: faker.random.uuid(),
content,
creationTime: (new Date()).getTime().toString(),
author: {
name: user.profile.name,
avatar: user.profile.avatar
},
channel: {
id: channelId,
}
};
messagesArray.unshift(newMessage);
pubsub.publish(CHAT_MESSAGE_SUBSCRIPTION_TOPIC, { chatMessageAdded: newMessage });
return newMessage;
}),
示例2: describe
describe('injector', () => {
const elementId = random.uuid()
test('vaild id', () => {
const config: any = {
id: random.alphaNumeric(10),
host: random.alphaNumeric(15),
ignore: random.alphaNumeric(15)
}
inject(elementId, `a${random.uuid()}`, config) // The attribute key must start with an alphabet.
expect(document.getElementById(elementId))
})
test('ignore domain', () => {
const config: any = {
id: random.alphaNumeric(10),
host: random.alphaNumeric(15),
ignore: 'about:blank'
}
inject(elementId, `a${random.uuid()}`, config) // L13
expect(document.getElementById(elementId))
})
})
示例3: return
return () => faker.random.number(options);
示例5: randomRelationshipType
public static randomRelationshipType() {
return faker.random.arrayElement([
'Business', 'Online Service Provider'
]);
}
示例6:
const words = (c) => faker.random.words(c)
示例7:
direct: () => faker.random.boolean(),