open-nomad/ui/app/utils/properties/short-uuid.js
Alex Dadgar e5ec915ac3 sync
2017-09-19 10:08:23 -05:00

15 lines
362 B
JavaScript

import Ember from 'ember';
const { computed } = Ember;
// 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];
});
}