UNPKG

igniteui-react-core

Version:
102 lines (101 loc) 3.97 kB
/* THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE: https://www.infragistics.com/legal/license/igultimate-la https://www.infragistics.com/legal/license/igultimate-eula GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company. */ import { __generator, __read, __values } from "tslib"; import { EnumerableIteratorWrapper, IteratorWrapper } from "./type"; var DictionaryUtil = /** @class */ /*@__PURE__*/ (function () { function DictionaryUtil() { } DictionaryUtil.dictionaryCreate = function (capacity) { return new Map(); }; DictionaryUtil.en = function (map) { var map_1, map_1_1, item, _a, key, value, e_1_1; var e_1, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _c.trys.push([0, 5, 6, 7]); map_1 = __values(map), map_1_1 = map_1.next(); _c.label = 1; case 1: if (!!map_1_1.done) return [3 /*break*/, 4]; item = map_1_1.value; _a = __read(item, 2), key = _a[0], value = _a[1]; return [4 /*yield*/, { key: key, value: value }]; case 2: _c.sent(); _c.label = 3; case 3: map_1_1 = map_1.next(); return [3 /*break*/, 1]; case 4: return [3 /*break*/, 7]; case 5: e_1_1 = _c.sent(); e_1 = { error: e_1_1 }; return [3 /*break*/, 7]; case 6: try { if (map_1_1 && !map_1_1.done && (_b = map_1.return)) _b.call(map_1); } finally { if (e_1) throw e_1.error; } return [7 /*endfinally*/]; case 7: return [2 /*return*/]; } }); }; DictionaryUtil.dictionaryGetEnumerator = function (map) { return new IteratorWrapper(DictionaryUtil.en(map), function () { return DictionaryUtil.en(map); }); }; DictionaryUtil.dictionaryGetKeys = function (map) { return new EnumerableIteratorWrapper(function () { return map.keys(); }); }; DictionaryUtil.dictionaryGetValues = function (map) { return new EnumerableIteratorWrapper(function () { return map.values(); }); }; DictionaryUtil.dictionaryGetValue = function (map, key) { return map.get(key); }; DictionaryUtil.dictionaryGetDictionary = function (obj) { var map = new Map(); for (var p in obj) { map.set(p.toString(), obj[p]); } return map; }; DictionaryUtil.dictionaryAddAll = function (map, other) { var e_2, _a; var otherKeys = other.keys(); var key; try { for (var otherKeys_1 = __values(otherKeys), otherKeys_1_1 = otherKeys_1.next(); !otherKeys_1_1.done; otherKeys_1_1 = otherKeys_1.next()) { var k = otherKeys_1_1.value; key = k; map.set(key, other.get(key)); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (otherKeys_1_1 && !otherKeys_1_1.done && (_a = otherKeys_1.return)) _a.call(otherKeys_1); } finally { if (e_2) throw e_2.error; } } }; return DictionaryUtil; }()); export { DictionaryUtil };