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