Commit afede0a9 authored by Nicolas Biri's avatar Nicolas Biri

shorter UUIDs

parent 5bb7df01
Pipeline #719 passed with stage
in 52 seconds
......@@ -10,11 +10,15 @@ Authors : J.S. Sottet, A. Vagner, N. Biri
'use strict'
const _ = require('lodash')
, uuid = require('uuid')
, Type = require('./Type')
, conformsTo = require('./Common').conformsTo
, Cardinality = require('./Cardinality').Cardinality
let conformsTo, generateId
(function () {
const Common = require('./Common')
conformsTo = Common.conformsTo
generateId = Common.generateId
}).call()
/**
* Creation of a JSMF Class.
......@@ -313,7 +317,7 @@ function createRemoveReference(o, name) {
function classMeta() {
return {uuid: uuid.v4(), conformsTo: Class}
return {uuid: generateId(), conformsTo: Class}
}
function setFlexible(b) {
......@@ -326,10 +330,9 @@ function setFlexible(b) {
}
}
function elementMeta(constructor) {
return { conformsTo: constructor
, uuid: uuid.v4()
, uuid: generateId()
, attributes: {}
, references: {}
, associated: {}
......
'use strict'
const _ = require('lodash')
, uuid = require('uuid')
function conformsTo(o) {
return _.get(o, ['__jsmf__', 'conformsTo'])
......@@ -16,8 +17,15 @@ function isJSMFElement(o) {
&& _.get(implement, 'getInheritanceChain') !== undefined
}
function generateId() {
const arrayUUID = new Array(16)
uuid.v4(null, arrayUUID)
return arrayUUID
}
module.exports =
{ conformsTo
, jsmfId
, isJSMFElement
, generateId
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment