How to use the @keystonejs/utils.defaultObj function in @keystonejs/utils

To help you get started, we’ve selected a few @keystonejs/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github keystonejs / keystone / packages / mongo-join-builder / lib / join-builder.js View on Github external
// `null`)
            $eq: [fieldSize, many ? { $size: { $ifNull: [`$${field}`, []] } } : 1],
          },
          [`${uniqueField}_none`]: { $eq: [fieldSize, 0] },
          [`${uniqueField}_some`]: { $gt: [fieldSize, 0] },
        },
      },
    ];
  });

  return [
    relationshipIdTerm && { $match: relationshipIdTerm },
    ...flatten(relationshipPipelines),
    matchTerm && { $match: matchTerm },
    { $addFields: { id: '$_id' } },
    excludeFields && excludeFields.length && { $project: defaultObj(excludeFields, 0) },
    ...postJoinPipeline,
  ].filter(i => i);
}