big-moving.ru/api/soft/monako/esm/vs/base/common/collections.js

27 lines
1.0 KiB
JavaScript
Raw Normal View History

2022-06-24 15:29:23 +05:00
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Iterates over each entry in the provided set. The iterator allows
* to remove elements and will stop when the callback returns {{false}}.
*/
export function forEach(from, callback) {
var _loop_1 = function (key) {
if (hasOwnProperty.call(from, key)) {
var result = callback({ key: key, value: from[key] }, function () {
delete from[key];
});
if (result === false) {
return { value: void 0 };
}
}
};
for (var key in from) {
var state_1 = _loop_1(key);
if (typeof state_1 === "object")
return state_1.value;
}
}