@atlaskit/editor-plugin-quick-insert
Version:
Quick insert plugin for @atlaskit/editor-core
8 lines • 570 B
JavaScript
/** Keeps score and priority handling consistent across Quick Insert search models. */
export var normalizeQuickInsertMatchResult = function normalizeQuickInsertMatchResult(match) {
var _match$score;
return {
priorityGroup: Number.isFinite(match === null || match === void 0 ? void 0 : match.priorityGroup) ? match === null || match === void 0 ? void 0 : match.priorityGroup : undefined,
score: Math.min(1, Math.max(0, (_match$score = match === null || match === void 0 ? void 0 : match.score) !== null && _match$score !== void 0 ? _match$score : 0))
};
};