Need-content-template now with less nested ternary operators.
@@ -189,12 +189,21 @@ import won from './won.js';
var isWhatsAround = args.is? args.is.whatsAround : args.seeks.whatsAround;
var noHints = args.is? args.is.noHints : args.seeks.noHints;
var matchingContext = args.is? args.is.matchingContext : args.seeks.matchingContext;
+
+ var isContentUri, seeksContentUri;
+ if(isWhatsAround) {
+ isContentUri = '_:needContent';
+ seeksContentUri = '_:needContent';
+ } else {
+ isContentUri = args.is? '_:isNeedContent' : undefined;
+ seeksContentUri = args.seeks? '_:seeksNeedContent' : undefined;
+ }
var graph = [
{
'@id': args.is? args.is.publishedContentUri : args.seeks.publishedContentUri,
'@type': 'won:Need',
- 'won:is': isWhatsAround? { '@id': '_:needContent' } : (args.is? { '@id': '_:isNeedContent' } : undefined),
- 'won:seeks': isWhatsAround? { '@id': '_:needContent' } : (args.seeks? { '@id': '_:seeksNeedContent' } : undefined),
+ 'won:is': isContentUri? { '@id': isContentUri } : undefined,
+ 'won:seeks': seeksContentUri? { '@id': seeksContentUri } : undefined,
'won:hasFacet': args.facet? args.facet : 'won:OwnerFacet',
'won:hasFlag': new Set([
won.debugmode? "won:UsedForTesting" : undefined,
@@ -208,8 +217,8 @@ import won from './won.js';
'won:hasMatchingContext': matchingContext? matchingContext : undefined,
},
//, <if _hasModalities> {... (see directly below) } </if>
- args.is? buildContentNode((isWhatsAround? '_:needContent' : '_:isNeedContent'), args.is, true) : {},
- args.seeks? (isWhatsAround? {} : (buildContentNode('_:seeksNeedContent', args.seeks, false))) : {},
+ args.is? buildContentNode(isContentUri, args.is, true) : {},
+ args.seeks && !isWhatsAround? buildContentNode(seeksContentUri, args.seeks, false) : {},
...(args.is && args.is.arbitraryJsonLd? args.is.arbitraryJsonLd : []),
...(args.seeks && args.seeks.arbitraryJsonLd? args.seeks.arbitraryJsonLd : []),
];
