mirror of
https://github.com/status-im/consul.git
synced 2025-01-09 21:35:52 +00:00
5fb9df1640
* Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at <Blog URL>, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
28 lines
898 B
JavaScript
28 lines
898 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { get, set } from '@ember/object';
|
|
import ObjectProxy from '@ember/object/proxy';
|
|
export default function (items, item, prop, value) {
|
|
value = typeof value === 'undefined' ? get(item, prop) : value;
|
|
const pos = items.findIndex(function (item) {
|
|
return get(item, prop) === value;
|
|
});
|
|
if (pos !== -1) {
|
|
// TODO: We only currently use this with EventSources
|
|
// would be good to check this doesn't do anything unexpected
|
|
// with other proxies.
|
|
// Before we get there, we might have figured a better way to do
|
|
// this anyway
|
|
if (item instanceof ObjectProxy) {
|
|
set(item, 'content', items.objectAt(pos));
|
|
}
|
|
items.replace(pos, 1, [item]);
|
|
// TODO: Looks like with new proxies this isn't needed anymore
|
|
// items.enumerableContentDidChange();
|
|
}
|
|
return item;
|
|
}
|