本文整理匯總了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
}