Repository URL to install this package:
|
Version:
1.2.18 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.toThingIdentifier = toThingIdentifier;
var _toIdentityHash = require("./toIdentityHash");
var _IDENTIFIER_REGISTRY = require("./IDENTIFIER_REGISTRY");
/**
* @alias toValueEqIdentity
*/
/**
* we extract the 3 key properties into this
*/
const small = Object.seal({
label: '',
value: '',
type: '' // meta: '',
// if we had, why use this
// identifier: '',
});
function toThingIdentifier(obj) {
if (_IDENTIFIER_REGISTRY.IDENTIFIER_REFERENCE_REGISTRY.has(obj)) {
return _IDENTIFIER_REGISTRY.IDENTIFIER_REFERENCE_REGISTRY.get(obj);
} // reuse for perf
small.label = obj.label;
small.value = obj.value;
small.type = obj.type; // could simplify here or ignore
// small.meta = obj.meta
return (0, _toIdentityHash.toIdentityHash)(small);
}