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


TypeScript Immutable.Set类代码示例

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


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

示例1: doFilter

  doFilter(keys: Set<string>): boolean {
    if (this._filter.size > 0) {
      if (!keys) {
        return this._filter.contains(NONE_FILTER_KEY);
      } else {
        if (this._filter.size === 1 && this._filter.contains(NONE_FILTER_KEY)) {
          // All we want to match is no components, and we have some components so return that we
          // should be filtered out
          return false;
        }


        for (const key of this._filterArray) {
          if (key === NONE_FILTER_KEY) {
            // We have values and we are looking for some values, for this case ignore the
            // none filter
            continue;
          }
          if (keys.contains(key)) {
            return true;
          }
        }
        return false;
      }
    }
    return true;
  }
开发者ID:rsvoboda,项目名称:overbaard-redux,代码行数:27,代码来源:filter.util.ts

示例2: it

  it('can compose Immutable::Set initial states', () => {
    const state = compose(Set.of(1, 2, 3), Set.of(4, 5, 6), Set.of());
    expect(Set.isSet(state)).to.be.true;

    const plain = state.toJS();
    expect(plain).not.to.be.null;
    expect(plain).to.deep.equal([1, 2, 3, 4, 5, 6]);
  });
开发者ID:danielfigueiredo,项目名称:ng2-redux-form,代码行数:8,代码来源:compose-reducers.test.ts

示例3: it

  it('expresses value equality with set sequences', () => {
    var s1 = Set.of('A', 'B', 'C');
    expect(s1.equals(null)).toBe(false);

    var s2 = Set.of('C', 'B', 'A');
    expect(s1 === s2).toBe(false);
    expect(is(s1, s2)).toBe(true);
    expect(s1.equals(s2)).toBe(true);

    // Map and Set are not the same (keyed vs unkeyed)
    var v1 = Map({ A: 'A', C: 'C', B: 'B' });
    expect(is(s1, v1)).toBe(false);
  });
开发者ID:Harishs84,项目名称:immutable-js,代码行数:13,代码来源:Set.ts

示例4: partialNameRefiner

function partialNameRefiner(previousParamValue: Set<string>, currentParamValue: Set<string>) {

    var lowerCurrParam = currentParamValue.map((param) => param.toLowerCase()).toSet();
    var lowerPrevParam = previousParamValue.map((param) => param.toLowerCase()).toSet();

    function partialNameComponentRefiner(curr:string):boolean {
        return lowerPrevParam.contains(curr)
            || lowerPrevParam.some((prevParam) => prevParam.includes(curr));
    }

    return lowerCurrParam
        .every((currParam) => partialNameComponentRefiner(currParam));
}
开发者ID:ovangle,项目名称:TNC-admin-client,代码行数:13,代码来源:member.manager.ts

示例5: buildParamValues

    buildParamValues(fragments: Set<string>):Map<string, any> {
        var paramValues = Map<string,any>();

        var idFragment = fragments.find((fragment) => !!fragment.match(/\d+/));
        if (idFragment) {
            paramValues = paramValues.set('id', Number.parseInt(idFragment));
        }

        var nameFragments = fragments
            .filter((fragment) => !!fragment.match(/\D+/))
            .map((fragment) => fragment.toLowerCase())
            .toSet();
        paramValues = paramValues.set('name', nameFragments);

        return paramValues;
    }
开发者ID:ovangle,项目名称:TNC-admin-client,代码行数:16,代码来源:parameter_builder.service.ts

示例6: Set

export const findEntries = (context: Context) => {
    const { trace } = context
    let entries = Set() as Set<string>
    let modulesToExplore = Set.of(...trace.keys())

    while (modulesToExplore.size > 0) {
        // pick a node and add it to entries
        const node = modulesToExplore.first()
        modulesToExplore = modulesToExplore.remove(node)
        entries = entries.add(node)

        const removeDepsOf = (dep) => {
            modulesToExplore = modulesToExplore.remove(dep)

            if (trace.has(dep))
                getDependencies(context, dep)
                    .forEach(depToRemove => {
                        if (entries.has(depToRemove)) entries = entries.remove(depToRemove)
                        else if (modulesToExplore.has(depToRemove)) removeDepsOf(depToRemove)
                    })
        }

        removeDepsOf(node)
    }

    return entries.toJS()
        .filter(entry => !entry.includes('jspm_packages'))
}
开发者ID:alexisvincent,项目名称:systemjs-hmr,代码行数:28,代码来源:util.ts


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