當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。