• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript tried.isLuck函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中basic/tried.isLuck函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isLuck函数的具体用法?TypeScript isLuck怎么用?TypeScript isLuck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了isLuck函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: lint

    function lint(
        projectFile: string,
        shared: Shared,
        configuration: Configs
    ): OneOfThree<Issue[], ts.Diagnostic[], Line<Severity>[]> {

        const runners = toRunners(configuration);
        if (bt.isLuck(runners)) {
            const [configured, unconfigured] = partition<bm.Some<Runner<Shared>>, bm.None>(runners.luck, bm.isSome);
            if (configured.length > 0) {
                const linted = run(
                    projectFile,
                    shared,
                    insteadEach(configured, bm.someOf)
                );
                if (bt.isLuck(linted)) {
                    return firstFrom(linted.luck);
                } else {
                    return secondFrom(linted.fuck);
                }
            } else {
                return thirdFrom(
                    fold(
                        unconfigured,
                        [lineFrom(Severity.Info, 'There are no available rules.')],
                        (result, unconfigured) => append(result, lineFrom(Severity.Info, unconfigured.none))
                    )
                );
            }
        } else {
            return thirdFrom(
                fold(
                    runners.fuck,
                    [lineFrom(Severity.Error, 'Unable to get runners ready.')],
                    (result, failure) => append(result, lineFrom(Severity.Error, failure))
                )
            );
        }
    }
开发者ID:aleksey-bykov,项目名称:linting,代码行数:39,代码来源:starting.ts


示例2: run

function run(args: string): void {
    const optionsTried = readOptions(args);
    const { log, dump } = toBeingStandardConsoleLogging(Severity.Info);
    if (bt.isLuck(optionsTried)) {
        const options = optionsTried.luck;
        log(Severity.Info, 'Reading configuration from: ' + options.configFile);
        const configuration = loadConfigs(options.configFile);
        if (bt.isLuck(configuration)) {
            const beingLogging = toBeingStandardConsoleLogging(options.verbosity);
            const beingOpening = toBeingOpening(
                beingLogging,
                toBeingConfiguring(ts.sys.readFile, ts.sys, beingLogging)
            );
            const pivotDirPath = process.cwd(); // TODO: consider allowing a parameter
            const beingTypeScriptFormatting = toBeingTypeScriptFormatting(filePath => toRelativeTo(filePath, pivotDirPath));
            const beingLintingFormatting = toBeingLintingFormatting(beingTypeScriptFormatting);
            const shared = toShared();
            const { lint, dumpDiagnostics, dumpIssues } = toBeingLinting(beingLogging, beingOpening, toRunners, beingTypeScriptFormatting, beingLintingFormatting);
            const output = lint(options.project, shared, configuration.luck);
            if (bf.isFirst(output)) {
                dumpIssues(output.first, options.maxNumberOfIssues);
            } else if (bf.isSecond(output)) {
                dumpDiagnostics(output.second, options.maxNumberOfDiagnostics);
            } else {
                ba.forEach(
                    output.third,
                    line => log(line.severity, line.message)
                );
            }
        } else {
            log(Severity.Error, 'Unable to load the configuration of the rules. ' + configuration.fuck.message);
        }
    } else {
        const problems = optionsTried.fuck;
        log(Severity.Info, 'Unable to start the linter.');
        dump(Severity.Info, problems, bb.same);
    }
}
开发者ID:aleksey-bykov,项目名称:linter,代码行数:38,代码来源:run.ts


示例3: haveCompiled

export function betterBeNoIssues<r>(tried: TriedCompiling, haveCompiled: (compiled: Compiled) => r): r {

    if (bt.isLuck(tried)) {
        return haveCompiled(tried.luck);
    } else {

        const issues = ba.fromList(tried.fuck);
        ba.forEach(issues, issue => {
            console.warn(formatDiagnostic(issue));
        });

        return bb.fail('Stopped due to detected issues.');
    }
}
开发者ID:aleksey-bykov,项目名称:linting,代码行数:14,代码来源:compiling-assertions.ts


示例4: 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;
    }
}
开发者ID:aleksey-bykov,项目名称:commandlining,代码行数:24,代码来源:reading.ts


示例5: dare

 dare(failure: string, format: (fail: b) => string): a {
     return isLuck(this.value) ? this.value.luck : fail(failure + ' ' + format(this.value.fuck));
 }
开发者ID:aleksey-bykov,项目名称:fluent,代码行数:3,代码来源:trying.ts



注:本文中的basic/tried.isLuck函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript tried.luckFrom函数代码示例发布时间:2022-05-25
下一篇:
TypeScript tried.insteadLuck函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap