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


TypeScript Immutable.OrderedMap函数代码示例

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


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

示例1: fetchMetros

export async function fetchMetros(ids: Set<string>): Promise<OrderedMap<string, Geo>> {
  if (ids.size) {
    const response = await axios.get(
      "/api/metro/",
      { params: { geoid__in: ids.join(",") } },
    );
    return response.data.results.reduce(geoReducer, OrderedMap<string, Geo>());
  }
  return OrderedMap<string, Geo>();
}
开发者ID:cmc333333,项目名称:mapusaurus,代码行数:10,代码来源:geography.ts

示例2: it

 it('respects order when merging', () => {
   var m1 = OrderedMap({A: 'apple', B: 'banana', C: 'coconut'});
   var m2 = OrderedMap({C: 'chocolate', B: 'butter', D: 'donut'});
   expect(m1.merge(m2).entrySeq().toArray()).toEqual(
     [['A','apple'],['B','butter'],['C','chocolate'],['D','donut']]
   );
   expect(m2.merge(m1).entrySeq().toArray()).toEqual(
     [['C','coconut'],['B','banana'],['D','donut'],['A','apple']]
   );
 });
开发者ID:AntanasBarauskas,项目名称:immutable-js,代码行数:10,代码来源:OrderedMap.ts

示例3: fetchLenders

export async function fetchLenders(ids: Set<string>): Promise<OrderedMap<string, string>> {
  if (ids.size) {
    const response = await axios.get(
      "/api/respondents/",
      { params: { institution_id__in: ids.join(",") } },
    );
    return response.data.results.reduce(
      (soFar, { institution_id, name }) => soFar.set(institution_id, name),
      OrderedMap<string, string>(),
    );
  }
  return OrderedMap<string, string>();
}
开发者ID:cmc333333,项目名称:mapusaurus,代码行数:13,代码来源:lenders.ts

示例4: constructor

 constructor(dispatcher:ActionDispatcher, pageModel:PageModel, props:CollFormProps) {
     super(
         dispatcher,
         {
             availCbgrfns: Immutable.OrderedMap<string, string>([
                 ['t', 'T-score'],
                 ['m', 'MI'],
                 ['3', 'MI3'],
                 ['l', 'log likelihood'],
                 ['s', 'min. sensitivity'],
                 ['d', 'logDice'],
                 ['p', 'MI.log_f'],
                 ['r', 'relative freq.']
             ]),
             attrList: Immutable.List<Kontext.AttrItem>(props.attrList),
             cattr: props.cattr,
             cfromw: {value: props.cfromw, isRequired: true, isInvalid: false},
             ctow: {value: props.ctow, isRequired: true, isInvalid: false},
             cminfreq: {value: props.cminfreq, isRequired: true, isInvalid: false},
             cminbgr: {value: props.cminbgr, isRequired: true, isInvalid: false},
             cbgrfns: Immutable.Set<string>(props.cbgrfns),
             csortfn: props.csortfn
         }
     );
     this.pageModel = pageModel;
 }
开发者ID:czcorpus,项目名称:kontext,代码行数:26,代码来源:collForm.ts

示例5: function

        oReq.onload = function (e) {
            var arraybuffer = oReq.response;

            /* convert data to binary string */
            var data = new Uint8Array(arraybuffer);
            var arr = new Array();
            for (var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
            var bstr = arr.join("");

            /* Call XLSX */


            // var XLSX:xlsx. = require("xlsx");
            var workbook: xlsx.IWorkBook = xlsx.read(bstr, { type: "binary" });
            var firstSheet: xlsx.IWorkSheet = workbook.Sheets[workbook.SheetNames[0]];
            console.log(firstSheet)

            const FIRST_ROW = 6;
            const LAST_ROW = 47;
            var students = Immutable.OrderedMap<string, Student>();
            for (var i = FIRST_ROW; i <= LAST_ROW; i++) {
                var student: Student = {
                    id: firstSheet[`A${i}`].h,
                    name: firstSheet[`B${i}`].h
                };

                students = students.set(student.id, student);
            }
            dispatch({ type: GET_STUDENTS, data: students });
        }
开发者ID:SSE-13,项目名称:homework-reporter,代码行数:30,代码来源:actions.ts

示例6: async

 (state: string) => async (text: string) => {
   const response = await axios.get(
     "/api/county/",
     { params: { state, q: text } },
   );
   return response.data.results.reduce(geoReducer, OrderedMap<string, Geo>());
 };
开发者ID:cmc333333,项目名称:mapusaurus,代码行数:7,代码来源:geography.ts

示例7: it

 it('supports React elements {min: false}', () => {
   const reactElement = React.createElement('Mouse', null, 'Hello World');
   expect(
     Immutable.OrderedMap({a: reactElement, b: reactElement}),
   ).toPrettyPrintTo(
     'Immutable.OrderedMap {\n  "a": <Mouse>\n    Hello World\n  </Mouse>,\n  "b": <Mouse>\n    Hello World\n  </Mouse>,\n}',
   );
 });
开发者ID:Volune,项目名称:jest,代码行数:8,代码来源:Immutable.test.ts


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