@openframe-org/criteria-set-protocol 2.2.16 → 2.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/v1/utils.d.ts +5 -1
- package/dist/v1/utils.js +20 -1
- package/package.json +1 -1
package/dist/v1/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Color, CriteriaTree, CriteriaTreeElement, Theme, Criterion, Task, TaskGroup, TaskItem, ThemeOptions, CriterionOptions, TaskOptions } from "./types";
|
|
1
|
+
import { Color, CriteriaTree, CriteriaTreeElement, Theme, Criterion, Task, TaskGroup, TaskItem, ThemeOptions, CriterionOptions, TaskOptions, CertificationDefinition, TaskItemValue } from "./types";
|
|
2
2
|
interface ApplyTextFormattingPlaceholdersForThemeFunction {
|
|
3
3
|
(options: ThemeOptions, element: Pick<Task, "title" | "code">): string;
|
|
4
4
|
}
|
|
@@ -45,4 +45,8 @@ export declare const applyCriteriaTreeElementTextFormatFormattingPlaceholders: A
|
|
|
45
45
|
* Apply the text formatting used in the report title
|
|
46
46
|
*/
|
|
47
47
|
export declare const applyReportTitleTextFormatFormattingPlaceholders: ApplyReportTitleTextFormatFormattingPlaceholdersFunction;
|
|
48
|
+
/**
|
|
49
|
+
* Given a list of certification definitions, return the ones for which the given value is valid
|
|
50
|
+
*/
|
|
51
|
+
export declare const getCertificationsByValue: (certificationDefinitions?: CertificationDefinition[], value?: TaskItemValue) => CertificationDefinition[] | undefined;
|
|
48
52
|
export {};
|
package/dist/v1/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyReportTitleTextFormatFormattingPlaceholders = exports.applyCriteriaTreeElementTextFormatFormattingPlaceholders = exports.applyDocumentTreeFolderTextFormattingPlaceholders = exports.applyBreadcrumbTextFormattingPlaceholders = exports.findInTree = exports.toColorHexString = exports.isTaskItem = exports.isTask = exports.isTaskGroup = exports.isCriterion = exports.isTheme = void 0;
|
|
3
|
+
exports.getCertificationsByValue = exports.applyReportTitleTextFormatFormattingPlaceholders = exports.applyCriteriaTreeElementTextFormatFormattingPlaceholders = exports.applyDocumentTreeFolderTextFormattingPlaceholders = exports.applyBreadcrumbTextFormattingPlaceholders = exports.findInTree = exports.toColorHexString = exports.isTaskItem = exports.isTask = exports.isTaskGroup = exports.isCriterion = exports.isTheme = void 0;
|
|
4
4
|
const isTheme = (element) => element.type === "theme";
|
|
5
5
|
exports.isTheme = isTheme;
|
|
6
6
|
const isCriterion = (element) => element.type === "criterion";
|
|
@@ -70,3 +70,22 @@ const applyReportTitleTextFormatFormattingPlaceholders = ({ reportTitleTextForma
|
|
|
70
70
|
.replace(/:code:/g, code)
|
|
71
71
|
.replace(/:title:/g, title);
|
|
72
72
|
exports.applyReportTitleTextFormatFormattingPlaceholders = applyReportTitleTextFormatFormattingPlaceholders;
|
|
73
|
+
/**
|
|
74
|
+
* Given a list of certification definitions, return the ones for which the given value is valid
|
|
75
|
+
*/
|
|
76
|
+
const getCertificationsByValue = (certificationDefinitions, value) => {
|
|
77
|
+
if (typeof value !== "number") {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
return certificationDefinitions === null || certificationDefinitions === void 0 ? void 0 : certificationDefinitions.filter((definition) => {
|
|
81
|
+
return ((definition.rules.minimum === undefined ||
|
|
82
|
+
value > definition.rules.minimum) &&
|
|
83
|
+
(definition.rules.exclusiveMinimum === undefined ||
|
|
84
|
+
value >= definition.rules.exclusiveMinimum) &&
|
|
85
|
+
(definition.rules.maximum === undefined ||
|
|
86
|
+
value < definition.rules.maximum) &&
|
|
87
|
+
(definition.rules.exclusiveMaximum === undefined ||
|
|
88
|
+
value <= definition.rules.exclusiveMaximum));
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
exports.getCertificationsByValue = getCertificationsByValue;
|
package/package.json
CHANGED