@openframe-org/criteria-set-protocol 2.5.1 → 2.5.2

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.
@@ -45,6 +45,7 @@ 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
+ export declare const isNil: (value: unknown) => value is null | undefined;
48
49
  /**
49
50
  * Given a list of certification definitions, return the ones for which the given value is valid
50
51
  */
package/dist/v1/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.getCertificationsByValue = exports.isNil = 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,6 +70,8 @@ const applyReportTitleTextFormatFormattingPlaceholders = ({ reportTitleTextForma
70
70
  .replace(/:code:/g, code)
71
71
  .replace(/:title:/g, title);
72
72
  exports.applyReportTitleTextFormatFormattingPlaceholders = applyReportTitleTextFormatFormattingPlaceholders;
73
+ const isNil = (value) => value === null || value === undefined;
74
+ exports.isNil = isNil;
73
75
  /**
74
76
  * Given a list of certification definitions, return the ones for which the given value is valid
75
77
  */
@@ -78,13 +80,13 @@ const getCertificationsByValue = (certificationDefinitions, value) => {
78
80
  return undefined;
79
81
  }
80
82
  return certificationDefinitions.filter((definition) => {
81
- return ((definition.rules.minimum === undefined ||
83
+ return (((0, exports.isNil)(definition.rules.minimum) ||
82
84
  value > definition.rules.minimum) &&
83
- (definition.rules.exclusiveMinimum === undefined ||
85
+ ((0, exports.isNil)(definition.rules.exclusiveMinimum) ||
84
86
  value >= definition.rules.exclusiveMinimum) &&
85
- (definition.rules.maximum === undefined ||
87
+ ((0, exports.isNil)(definition.rules.maximum) ||
86
88
  value < definition.rules.maximum) &&
87
- (definition.rules.exclusiveMaximum === undefined ||
89
+ ((0, exports.isNil)(definition.rules.exclusiveMaximum) ||
88
90
  value <= definition.rules.exclusiveMaximum));
89
91
  });
90
92
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openframe-org/criteria-set-protocol",
3
- "version": "2.5.1",
3
+ "version": "2.5.2",
4
4
  "description": "A protocol and tools for defining and working with criteria sets",
5
5
  "private": false,
6
6
  "author": "Andrés Angulo <aa@openframe.org>",