本文整理匯總了TypeScript中Immutable.OrderedMap.get方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript OrderedMap.get方法的具體用法?TypeScript OrderedMap.get怎麽用?TypeScript OrderedMap.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Immutable.OrderedMap
的用法示例。
在下文中一共展示了OrderedMap.get方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it ('Add several custom fields', () => {
const state: CustomFieldState = getTestCustomFieldState();
customFieldMetaReducer(initialCustomFieldState, CustomFieldActions.createDeserializeCustomFields(getTestCustomFieldsInput()));
const newState: CustomFieldState =
customFieldMetaReducer(state, CustomFieldActions.createAddCustomFields({
'Custom-1': [{key: 'c1-a', value: 'A'}, {key: 'c1-z', value: 'Z'}],
'Custom-2': [{key: 'c2-k', value: 'k'}]}));
const map: OrderedMap<string, List<CustomField>> = newState.fields.map(value => value.toList()).toOrderedMap();
expect(map.size).toBe(2);
const l1 = map.get('Custom-1');
expect(l1.size).toBe(5);
expect(l1.get(0).key).toEqual('c1-a');
expect(l1.get(0).value).toEqual('A');
expect(l1.get(1).key).toEqual('c1-A');
expect(l1.get(1).value).toEqual('First C1');
expect(l1.get(2).key).toEqual('c1-B');
expect(l1.get(2).value).toEqual('Second C1');
expect(l1.get(3).key).toEqual('c1-C');
expect(l1.get(3).value).toEqual('Third C1');
expect(l1.get(4).key).toEqual('c1-z');
expect(l1.get(4).value).toEqual('Z');
const l2 = map.get('Custom-2');
expect(l2.size).toBe(3);
expect(l2.get(0).key).toEqual('c2-A');
expect(l2.get(0).value).toEqual('First C2');
expect(l2.get(1).key).toEqual('c2-k');
expect(l2.get(1).value).toEqual('k');
expect(l2.get(2).key).toEqual('c2-B');
expect(l2.get(2).value).toEqual('Second C2');
});