github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/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 }