本文整理匯總了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}',
);
});