本文整理汇总了TypeScript中lodash.partial函数的典型用法代码示例。如果您正苦于以下问题:TypeScript partial函数的具体用法?TypeScript partial怎么用?TypeScript partial使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了partial函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getById
getById(req: Request, res: Response) {
const userId = parseInt(req.params.id);
User
.getById(userId)
.then(_.partial(Handlers.onSuccess, res))
.catch(_.partial(Handlers.onError, res, 'Erro ao buscar usuรกrio'));
}
示例2: createUser
createUser(req: Request, res: Response) {
User
.create(req.body)
.then(_.partial(Handlers.onSuccess, res))
.catch(_.partial(Handlers.dbErrorHandler, res))
.catch(_.partial(Handlers.onError, res, `Erro ao inserir novo usuรกrio`));
}
示例3: updateUser
updateUser(req: Request, res: Response) {
const userId = parseInt(req.params.id);
User
.update(userId, req.body)
.then(_.partial(Handlers.onSuccess, res))
.catch(_.partial(Handlers.onError, res, 'Erro ao atualizar usuรกrio'));
}
示例4: getTransactionsInternal
function getTransactionsInternal(connection: Connection, address: string,
options: TransactionsOptions
): Promise<GetTransactionsResponse> {
const getter = _.partial(getAccountTx, connection, address, options)
const format = _.partial(formatResponse, connection, options)
return utils.getRecursive(getter, options.limit).then(format)
}
示例5: getCourseDetail
export function getCourseDetail(req: Request, res: Response) {
const courseId = parseInt(req.params.id);
findCourseDetail(courseId)
.then(_.partial(onSuccess, res))
.catch(_.partial(onError, res, "Find all courses failed"));
}
示例6: postLesson
export function postLesson(req: Request, res: Response) {
return createLesson(req.body)
.then(_.partial(onSuccess, res))
.catch(_.partial(onDbError, res, "Error on lesson creation"))
.catch(_.partial(onError, res, "Find all courses failed"));
}
示例7: deleteUser
deleteUser(req: Request, res: Response) {
const userId = parseInt(req.params.id);
User
.delete(userId)
.then(_.partial(Handlers.onSuccess, res))
.catch(_.partial(Handlers.onError, res, 'Erro ao excluir usuรกrio'));
}
示例8: deleteLesson
export function deleteLesson(req: Request, res: Response) {
const lessonId = req.params.id;
return deleteLessonById(lessonId)
.then(_.partial(onSuccess, res))
.catch(_.partial(onDbError, res, "Error on lesson delete"))
.catch(_.partial(onError, res, "Find all courses failed"));
}
示例9: patchLesson
export function patchLesson(req: Request, res: Response) {
const lessonId = req.params.id;
const props = _.omit(req.body, ["id"]);
return updateLesson(lessonId, props)
.then(_.partial(onSuccess, res))
.catch(_.partial(onDbError, res, "Error on lesson update"))
.catch(_.partial(onError, res, "Find all courses failed"));
}
示例10: formatPartialResponse
function formatPartialResponse(address: string,
options: TransactionsOptions, data
) {
return {
marker: data.marker,
results: data.transactions
.filter(tx => tx.validated)
.map(parseAccountTxTransaction)
.filter(_.partial(transactionFilter, address, options))
.filter(_.partial(orderFilter, options))
}
}