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


TypeScript Immutable.Map函数代码示例

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


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

示例1:

import { NotebookContentRecord, NotebookModel } from "./notebook";
import { DirectoryContentRecord, DirectoryModelRecord } from "./directory";
import { DummyContentRecord, EmptyModelRecord } from "./dummy";
import { FileContentRecord, FileModelRecord } from "./file";

export * from "./notebook";
export * from "./directory";
export * from "./dummy";
export * from "./file";

export type ContentModel =
  | NotebookModel
  | DirectoryModelRecord
  | FileModelRecord
  | EmptyModelRecord;

export type ContentRecord =
  | NotebookContentRecord
  | DummyContentRecord
  | FileContentRecord
  | DirectoryContentRecord;

export type ContentsRecordProps = {
  byRef: Immutable.Map<ContentRef, ContentRecord>;
};

export const makeContentsRecord = Immutable.Record<ContentsRecordProps>({
  byRef: Immutable.Map()
});
开发者ID:kelleyblackmore,项目名称:nteract,代码行数:29,代码来源:index.ts

示例2: publishName

 public publishName() {
     publish({
         key: Keys.ChangeName,
         payload: Map({name:this.name()})
     })
 }
开发者ID:darcy-buttrose,项目名称:rx-ko-phantom-mocha,代码行数:6,代码来源:HomePageViewModel.ts

示例3:

 geos: () => Map<GeoId, Geo>(),
开发者ID:cmc333333,项目名称:mapusaurus,代码行数:1,代码来源:Factory.ts

示例4:

export const transientCellMap = (model: NotebookModel) =>
  model.transient.get("cellMap", Immutable.Map());
开发者ID:kelleyblackmore,项目名称:nteract,代码行数:2,代码来源:notebook.ts

示例5: it

 it('merges two maps with a merge function', () => {
   var m1 = Map({a:1,b:2,c:3});
   var m2 = Map({d:10,b:20,e:30});
   expect(m1.mergeWith((a, b) => a + b, m2)).is(Map({a:1,b:22,c:3,d:10,e:30}));
 })
开发者ID:AntanasBarauskas,项目名称:immutable-js,代码行数:5,代码来源:merge.ts

示例6:

combineReducers<State, AnyAction, string>({}, () => { return Map<string, State>(); });
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:1,代码来源:redux-immutable-tests.ts

示例7: it

 it('is conservative with array-likes, only accepting true Arrays.', () => {
   expect(fromJS({1: 2, length: 3})).is(
     Map().set('1', 2).set('length', 3)
   );
   expect(fromJS('string')).toEqual('string');
 });
开发者ID:Azatey,项目名称:immutable-js,代码行数:6,代码来源:Conversion.ts

示例8: describe

describe('Conversion', () => {

  beforeEach(function () {
    this.addMatchers({
      is: function(expected) {
        return is(this.actual, expected);
      }
    });
  });

  // Note: order of keys based on Map's hashing order
  var js = {
    deepList: [
      {
        position: "first"
      },
      {
        position: "second"
      },
      {
        position: "third"
      },
    ],
    deepMap: {
      a: "A",
      b: "B"
    },
    emptyMap: Object.create(null),
    point: {x: 10, y: 20},
    string: "Hello",
    list: [1, 2, 3]
  };

  var Point = Record({x:0, y:0}, 'Point');

  var immutableData = Map({
    deepList: List.of(
      Map({
        position: "first"
      }),
      Map({
        position: "second"
      }),
      Map({
        position: "third"
      })
    ),
    deepMap: Map({
      a: "A",
      b: "B"
    }),
    emptyMap: Map(),
    point: Map({x: 10, y: 20}),
    string: "Hello",
    list: List.of(1, 2, 3)
  });

  var immutableOrderedData = OrderedMap({
    deepList: List.of(
      OrderedMap({
        position: "first"
      }),
      OrderedMap({
        position: "second"
      }),
      OrderedMap({
        position: "third"
      })
    ),
    deepMap: OrderedMap({
      a: "A",
      b: "B"
    }),
    emptyMap: OrderedMap(),
    point: new Point({x: 10, y: 20}),
    string: "Hello",
    list: List.of(1, 2, 3)
  });

  var immutableOrderedDataString = 'OrderedMap { ' +
    '"deepList": List [ '+
      'OrderedMap { '+
        '"position": "first"'+
      ' }, ' +
      'OrderedMap { '+
        '"position": "second"'+
      ' }, '+
      'OrderedMap { '+
        '"position": "third"'+
      ' }' +
    ' ], '+
    '"deepMap": OrderedMap { '+
      '"a": "A", '+
      '"b": "B"'+
    ' }, '+
    '"emptyMap": OrderedMap {}, ' +
    '"point": Point { "x": 10, "y": 20 }, '+
    '"string": "Hello", '+
    '"list": List [ 1, 2, 3 ]'+
  ' }';
//.........这里部分代码省略.........
开发者ID:Azatey,项目名称:immutable-js,代码行数:101,代码来源:Conversion.ts

示例9: it

  it ('returns a default state', () => {   
    let reduc = reducer(undefined, {})

    verifyDefault(reduc);
    expect( Immutable.is(reduc.result, Immutable.Map()) ).toBeTruthy();
  });  
开发者ID:jasonaden,项目名称:restore,代码行数:6,代码来源:resource-list-reducer.spec.ts


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