github.com/hernad/nomad@v1.6.112/ui/app/utils/properties/uniquely.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import { computed } from '@ember/object'; 7 import { guidFor } from '@ember/object/internals'; 8 9 // An Ember.Computed property for creating a unique string with a 10 // common prefix (based on the guid of the object with the property) 11 // 12 // ex. @uniquely('name') // 'name-ember129383' 13 export default function uniquely(prefix) { 14 return computed(function () { 15 return `${prefix}-${guidFor(this)}`; 16 }); 17 }