• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript Immutable.Map函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript Immutable.OrderedMap函数代码示例发布时间:2022-05-25
下一篇:
TypeScript Immutable.List函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap