open-nomad/ui/app/utils/properties/short-uuid.js

13 lines
348 B
JavaScript
Raw Normal View History

import { computed } from '@ember/object';
2017-09-19 14:47:10 +00:00
// An Ember.Computed property for taking the first segment
// of a uuid.
//
// ex. id: 123456-7890-abcd-efghijk
// short: shortUUIDProperty('id') // 123456
export default function shortUUIDProperty(uuidKey) {
return computed(uuidKey, function() {
return this.get(uuidKey).split('-')[0];
});
}