Repository URL to install this package:
|
Version:
1.3.0 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @alias toValueEqIdentity
*/
const toIdentityHash_1 = require("./toIdentityHash");
const IDENTIFIER_REGISTRY_1 = require("./IDENTIFIER_REGISTRY");
/**
* we extract the 3 key properties into this
*/
const small = Object.seal({
label: '',
value: '',
type: '',
});
function toThingIdentifier(obj) {
if (IDENTIFIER_REGISTRY_1.IDENTIFIER_REFERENCE_REGISTRY.has(obj)) {
return IDENTIFIER_REGISTRY_1.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 toIdentityHash_1.toIdentityHash(small);
}
exports.toThingIdentifier = toThingIdentifier;
//# sourceMappingURL=toThingIdentifier.js.map