import { assert } from '@ember/debug'; /** * This helper can be used to support both `@model` and `@models` arguments when wrapping * the `` component without it triggering assertions or having to use the component helper. * * The result of this helper should be passed into the `@models` argument of the `` component: * * ```hbs * ... * ``` * * It uses similar logic as the `` component: * https://github.com/emberjs/ember.js/blob/v3.26.1/packages/%40ember/-internals/glimmer/lib/components/link-to.ts#L524-L540 * @private */ export default function linkToModels( model?: unknown, models?: unknown[], ): unknown[] { assert( 'You cannot provide both the `@model` and `@models` arguments to the component.', !model || !models, ); if (model) { return [model]; } else if (models) { return models; } else { return []; } }