github.com/hernad/nomad@v1.6.112/ui/app/utils/properties/short-uuid.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import { computed } from '@ember/object'; 7 8 // An Ember.Computed property for taking the first segment 9 // of a uuid. 10 // 11 // ex. id: 123456-7890-abcd-efghijk 12 // short: shortUUIDProperty('id') // 123456 13 export default function shortUUIDProperty(uuidKey) { 14 return computed(uuidKey, function () { 15 return this.get(uuidKey)?.split('-')[0]; 16 }); 17 }