本文整理汇总了TypeScript中scuid类的典型用法代码示例。如果您正苦于以下问题:TypeScript scuid类的具体用法?TypeScript scuid怎么用?TypeScript scuid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了scuid类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Array
return new Array(count).fill(0).map(_ => ({
id: scuid(),
title: faker.random.words(),
body: faker.lorem.sentences(),
published: faker.random.boolean(),
createdAt: faker.date.past(),
author: {
id: scuid(),
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
email: faker.internet.email(),
avatar: faker.image.avatar()
}
}));
示例2: async
login: async (
parent,
{ email, password, expiresIn = '2d' },
{ jwtSecret },
info
) => ({
token: await generateAuthToken(
{ email, userId: scuid() },
jwtSecret,
expiresIn
)
}),
示例3: scuid
Post: (parent, { id }, { faker }) => ({
id,
title: faker.random.words(),
body: faker.lorem.paragraphs(),
published: faker.random.boolean(),
createdAt: faker.date.past(),
author: {
id: scuid(),
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
email: faker.internet.email(),
avatar: faker.image.avatar()
}
}),
示例4: makeMockConfig
function makeMockConfig(mockInquirer?: any) {
const home = getTmpDir()
const cwd = path.join(home, cuid())
fs.mkdirpSync(cwd)
return {
config: new Config({ mock: true, home, cwd, mockInquirer }),
home,
cwd,
}
}
示例5:
const getPingUrl = (region: string) =>
`${getDynamoUrl(region)}/ping?x=${cuid()}`
示例6: cuid
export const getTmpDir = () => {
const dir = path.join(os.tmpdir(), cuid() + '/')
fs.mkdirpSync(dir)
return dir
}