本文整理汇总了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>();
}
示例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']]
);
});
示例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>();
}
示例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;
}
示例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 });
}
示例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>());
};
示例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}',
);
});