mechanical-tolerance-calculator 1.1.4 → 1.1.5

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.
Files changed (2) hide show
  1. package/index.js +5 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -101,14 +101,6 @@ function isValidMeasurement(measurement) {
101
101
  return !isNaN(num) && num >= 0 && num < 1000;
102
102
  }
103
103
 
104
- function validateMeasurement(measurement) {
105
- const isMeasurementValid = isValidMeasurement(measurement);
106
- if (!isMeasurementValid) {
107
- return { error: "Measurement must be between 0 to 1000." };
108
- }
109
- return measurement;
110
- }
111
-
112
104
  function parseNominalFromMeasurement(
113
105
  measurement,
114
106
  materialType,
@@ -371,6 +363,11 @@ function processIndividualMeasurement(materialType, measurement, tolerances) {
371
363
  }
372
364
 
373
365
  function checkMultipleMeasurementsFor(materialType, measurements) {
366
+ const validated = validateMeasurements(measurements);
367
+ if (validated) {
368
+ return validated;
369
+ }
370
+
374
371
  const errors = [];
375
372
 
376
373
  measurements.forEach((m, index) => {
@@ -400,9 +397,6 @@ function checkMultipleMeasurementsFor(materialType, measurements) {
400
397
  let count = 0;
401
398
  let withInSpecs = [];
402
399
  const results = measurements.map((measurement) => {
403
- if (!isValidMeasurement(measurement)) {
404
- return { error: "Measurement must be between 0 to 1000." };
405
- }
406
400
  const result = processIndividualMeasurement(
407
401
  camcoStandardTolerances.type,
408
402
  measurement,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mechanical-tolerance-calculator",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Calculates international standard specification and tolerances for bores, round bars and metals of mechanical units. For examples; H7, H8, H9, h8, h9 specifications and IT5/IT6 tolerances.",
5
5
  "main": "index.js",
6
6
  "scripts": {