当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript tried.insteadFuck函数代码示例

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


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

示例1: toOptions

export function toRunner<Options, State, Shared>(
    ruleKey: string,
    configs: Configs,
    toOptions: (config: {}) => bt.Tried<Options, string[]>,
    rule: FileRule<Options, State, Shared>
): bt.Tried<bo.Optional<Runner<Shared>>, string[]> {
    const config = configs[ruleKey];
    if (config !== undefined) {
        return bt.insteadFuck(
            bt.insteadLuck(
                toOptions(config),
                options => {
                    const runner = runnerFrom(
                        ruleKey,
                        (program, shared) => applyFileRule(program, options, rule, ruleKey, shared)
                    );
                    return bo.someFrom(runner)
                }
            ),
            problems => ba.insteadEach(
                problems,
                problem => 'Rule \'' + ruleKey + '\' has invalid configuration. ' + problem
            )
        );
    } else {
        return bt.luckFrom(
            bo.noneFrom('Rule \'' + ruleKey + '\' is disabled due to not being configured.')
        );
    }
}
开发者ID:aleksey-bykov,项目名称:linting,代码行数:30,代码来源:configuring.ts

示例2: readClusion

export function readClusion(config: ClusionConfig): Tried<RegExp, string>[] {
    if (br.isString(config)) {
        return [insteadFuck(toRegexp(config), messageOf)];
    } else if (br.isArray(config)) {
        return ba.insteadEach(
            ba.insteadEach(
                config,
                config => br.isString(config)
                    ? insteadFuck(toRegexp(config), messageOf)
                    : readRegexp(config)
            ),
            (tried, index) => insteadFuck(tried, fuck => 'At #' + index + ': ' + fuck)
        );
    } else {
        return [readRegexp(config)]
    }
}
开发者ID:aleksey-bykov,项目名称:linting,代码行数:17,代码来源:file-filter.ts

示例3: insteadFuck

 (tried, index) => insteadFuck(tried, fuck => 'At #' + index + ': ' + fuck)
开发者ID:aleksey-bykov,项目名称:linting,代码行数:1,代码来源:file-filter.ts

示例4: readRegexp

export function readRegexp(config: RegexpConfig): Tried<RegExp, string> {
    return config.pattern === undefined
        ? fuckFrom('The "pattern" property is missing in a regex configuration object.')
        : insteadFuck(toRegexp(config.pattern, config.flags), messageOf)
}
开发者ID:aleksey-bykov,项目名称:linting,代码行数:5,代码来源:file-filter.ts

示例5: Trying

 inFail<c>(within: (value: b) => c): Trying<a, c> {
     return new Trying(insteadFuck(this.value, within));
 }
开发者ID:aleksey-bykov,项目名称:fluent,代码行数:3,代码来源:trying.ts


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