github.com/outbrain/consul@v1.4.5/ui-v2/app/helpers/policy/datacenters.js (about)

     1  import { helper } from '@ember/component/helper';
     2  import { get } from '@ember/object';
     3  
     4  /**
     5   * Datacenters can be an array of datacenters.
     6   * Anything that isn't an array means 'All', even an empty array.
     7   */
     8  export function datacenters(params, hash = {}) {
     9    const datacenters = get(params[0], 'Datacenters');
    10    if (!Array.isArray(datacenters) || datacenters.length === 0) {
    11      return [hash['global'] || 'All'];
    12    }
    13    return get(params[0], 'Datacenters');
    14  }
    15  
    16  export default helper(datacenters);