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


TypeScript Immutable.Set函数代码示例

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


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

示例1: getAllSelections

function getAllSelections(state: State): Set<Record<AnnotationSelection>> {
  const rangeSelections = state.getIn(['selection', 'annotation', 'range'])
  const pickSelections = state.getIn(['selection', 'annotation', 'pick'])
  const selected = state.getIn(['selection', 'annotation', 'selected'])
  const selectedSet = selected !== null ? Set().add(selected) : Set()
  return rangeSelections.union(pickSelections).union(selectedSet)
}
开发者ID:StudioProcess,项目名称:rvp,代码行数:7,代码来源:project.ts

示例2: describe

describe("formatter", () => {
  let priceMap = Map.of(
    215, Set(["mixed fruit", "bubble yum"]),
    275, Set(["french fries"]),
    335, Set(["side salad"]),
    355, Set(["hot wings"]),
    420, Set(["mozzarella sticks"]),
    580, Set(["sampler plate"])
  );

  let priceCombinations = Set([
    List([215, 215, 215, 215, 215, 215, 215]),
    List([215, 355, 355, 580])
  ]);

  let expectedResult = Set([
    Set(["7 orders of mixed fruit or bubble yum (at $2.15 each)."]),
    Set([
      "1 order of mixed fruit or bubble yum (at $2.15 each).",
      "1 order of mixed fruit or bubble yum (at $2.15 each).",
      "2 orders of hot wings (at $3.55 each).",
      "1 order of sampler plate (at $5.80 each)."
    ])
  ]);

  it("properly formats the supplied data", () => {
    let f = new Formatter(priceMap, priceCombinations);
    expect(f.getSentences().equals(expectedResult)).toBe(true);
  });
});
开发者ID:Ethan826,项目名称:tablexi-coding-challenge,代码行数:30,代码来源:formatter.spec.ts

示例3: createSelector

export const getAnnotationsSelections = createSelector(getProjectAnnotationSelection, annotationSelection => {
  const ranged = annotationSelection.get('range', null)
  const picked = annotationSelection.get('pick', null)
  const selected = annotationSelection.get('selected', null)
  const selectedSet: Set<Record<AnnotationSelection>> = selected ? Set().add(selected) : Set()
  return ranged.union(picked, selectedSet)
})
开发者ID:StudioProcess,项目名称:rvp,代码行数:7,代码来源:index.ts

示例4: Set

 const getState = () => StateFactory.build({
   lar: LarFactory.build({
     filters: FiltersFactory.build({
       county: Set(["1234", "2345"]),
       metro: Set(["3456"]),
     }),
     lookups: LookupsFactory.build({
       geos: Map([
         [
           "1234",
           new Geo("name", { lat: 29, lon: -10 }, { lat: 11, lon: -20 }),
         ],
         [
           "2345",
           new Geo("other", { lat: 29, lon: -11 }, { lat: 10, lon: -19 }),
         ],
         [
           "3456",
           new Geo("another", { lat: 30, lon: -11 }, { lat: 11, lon: -19 }),
         ],
       ]),
     }),
   }),
   window: { height: 100, width: 100 },
 });
开发者ID:cmc333333,项目名称:mapusaurus,代码行数:25,代码来源:Filters.test.ts

示例5:

 const getState = () => StateFactory.build({
   lar: LarFactory.build({
     filters: FiltersFactory.build({
       county: Set<string>(),
       metro: Set<string>(),
     }),
   }),
 });
开发者ID:cmc333333,项目名称:mapusaurus,代码行数:8,代码来源:Filters.test.ts

示例6: createCommandSet

function createCommandSet(commands: CommandData[]): Set<Command> {
  if (!commands) {
    return Set([]);
  }
  return commands.reduce((set, command) => {
    return set.add(createCommandRecord(command));
  }, Set([]));
}
开发者ID:threehams,项目名称:reverie-client,代码行数:8,代码来源:messageActions.ts

示例7: it

 it("loads county, lender, and metro", () => {
   const result = deriveLar("county=123&lender=456&metro=789", [2009]);
   expect(result.filters).toMatchObject({
     county: Set(["123"]),
     lender: Set(["456"]),
     metro: Set(["789"]),
   });
 });
开发者ID:cmc333333,项目名称:mapusaurus,代码行数:8,代码来源:initial-state.test.ts

示例8: List

 allowed: List(part.allowed.map((allow) => new Allowed({
   ...allow,
   components: Set(allow.components),
   names: Set(allow.names),
   owners: Set(allow.owners),
   states: Set(allow.states),
   types: Set(allow.types),
 }))),
开发者ID:threehams,项目名称:reverie-client,代码行数:8,代码来源:messageActions.ts

示例9: Error

 }).then((ud: UserDetail) => {
   if(!ud)
     throw new Error('Invalid Session');
   req.user = ud;
   // convert javascript arrays into Sets
   req.user.estates = Set<number>(req.user.estates);
   req.user.regions = Set<string>(req.user.regions);
   return next();
 }).catch((err: Error) => {
开发者ID:M-O-S-E-S,项目名称:mgm,代码行数:9,代码来源:Authorizer.ts


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