本文整理汇总了TypeScript中basic/optional.isSome函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isSome函数的具体用法?TypeScript isSome怎么用?TypeScript isSome使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isSome函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: isSome
(built, recognized) => isSome(recognized)
? luckFrom(
take(
built,
recognized.some
)
)
: fuckFrom([recognized.none]),
示例2: standFrom
export function read<Parsing, Parsed>(
value: string,
parsing: Parsing,
builder: Builder<Parsing>,
asParsed: (parsing: Parsing) => Optional<Parsed>
): Tried<Parsed, Error> {
const stand = standFrom(mightNeedCommandOrParameter, []);
const started = keepReading(parsing, value, 0, stand, builder);
if (isLuck(started)) {
const finished = finishReading(started.luck.result, started.luck.stand, builder)
if (isLuck(finished)) {
const parsed = asParsed(finished.luck);
if (isSome(parsed)) {
return luckFrom(parsed.some);
} else {
return toFailedToFindBuilderInParameterState();
}
} else {
return finished;
}
} else {
return started;
}
}
示例3: take
(built, recognized) => take(
built,
isSome(recognized)
? recognized.some
: defaultValue
),