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