github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/utils/properties/uniquely.js (about)

     1  import { computed } from '@ember/object';
     2  import { guidFor } from '@ember/object/internals';
     3  
     4  // An Ember.Computed property for creating a unique string with a
     5  // common prefix (based on the guid of the object with the property)
     6  //
     7  // ex. @uniquely('name') // 'name-ember129383'
     8  export default function uniquely(prefix) {
     9    return computed(function () {
    10      return `${prefix}-${guidFor(this)}`;
    11    });
    12  }