Skip to content

Commit

Permalink
Update dependency convert to v5 (#6234)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: BocognanoSarah <sarah.bocognano@filigran.io>
  • Loading branch information
renovate[bot] and SarahBocognano committed Mar 11, 2024
1 parent 7f524f6 commit 15c5085
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion opencti-platform/opencti-front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"axios": "1.6.7",
"ckeditor5-custom-build": "0.0.1",
"classnames": "2.5.1",
"convert": "4.14.1",
"convert": "5.0.0",
"d3-hierarchy": "3.1.2",
"d3-timer": "3.0.1",
"dagre": "0.8.5",
Expand Down
10 changes: 5 additions & 5 deletions opencti-platform/opencti-front/src/utils/hooks/useUserMetric.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FormatNumberOptions, useIntl } from 'react-intl';
import convert, { Length, Mass } from 'convert';
import convert, { Length, Mass, Unit } from 'convert';
import {
ThreatActorIndividualEditionBiographics_ThreatActorIndividual$data,
} from '@components/threats/threat_actors_individual/__generated__/ThreatActorIndividualEditionBiographics_ThreatActorIndividual.graphql';
Expand Down Expand Up @@ -45,7 +45,7 @@ const heightsConverterLoad = (userMetricType: SupportedUnitType) => {
const { measure, date_seen, index } = data;
const numericMeasure = parseFloat(String(measure));
const lengthPrimaryUnit = Units[userMetricType].length;
const converted = convert<number>(numericMeasure, 'm').to(lengthPrimaryUnit).toFixed(2); // Meter is the pivot format
const converted = convert<number, Unit>(numericMeasure, 'm').to(lengthPrimaryUnit).toFixed(2); // Meter is the pivot format
return { measure: Number(converted), date_seen, index };
});
};
Expand All @@ -54,7 +54,7 @@ const heightToPivotFormat = (userMetricType: SupportedUnitType) => {
return (measure: number | string | null | undefined) => {
const lengthPrimaryUnit = Units[userMetricType].length;
const numericMeasure = parseFloat(String(measure));
return Number(convert<number>(numericMeasure, lengthPrimaryUnit).to('m').toFixed(8)); // Meter is the pivot format
return Number(convert<number, Unit>(numericMeasure, lengthPrimaryUnit).to('m').toFixed(8)); // Meter is the pivot format
};
};
const heightsConverterSave = (userMetricType: SupportedUnitType) => {
Expand All @@ -71,7 +71,7 @@ const weightsConverterLoad = (userMetricType: SupportedUnitType) => {
return (weights ?? []).map(({ measure, date_seen, index }) => {
const numericMeasure = parseFloat(String(measure));
const weightPrimaryUnit = Units[userMetricType].weight;
const converted = convert<number>(numericMeasure, 'kg').to(weightPrimaryUnit).toFixed(2); // Meter is the pivot format
const converted = convert<number, Unit>(numericMeasure, 'kg').to(weightPrimaryUnit).toFixed(2); // Meter is the pivot format
return { measure: Number(converted), date_seen, index };
});
};
Expand All @@ -80,7 +80,7 @@ const weightToPivotFormat = (userMetricType: SupportedUnitType) => {
return (measure: number | string | null | undefined) => {
const weightPrimaryUnit = Units[userMetricType].weight;
const numericMeasure = parseFloat(String(measure));
return Number(convert<number>(numericMeasure, weightPrimaryUnit).to('kg').toFixed(8)); // Kg is the pivot format
return Number(convert<number, Unit>(numericMeasure, weightPrimaryUnit).to('kg').toFixed(8)); // Kg is the pivot format
};
};
const weightsConverterSave = (userMetricType: SupportedUnitType) => {
Expand Down
10 changes: 5 additions & 5 deletions opencti-platform/opencti-front/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8055,10 +8055,10 @@ __metadata:
languageName: node
linkType: hard

"convert@npm:4.14.1":
version: 4.14.1
resolution: "convert@npm:4.14.1"
checksum: 10/7402e80b9cab4cc87e7f26b8e4fbe208a589555e07296ba565391bccfdd6dd46a31596928636e4b1c25c84326c4d19fbaf6f13851e3d45d1f9a0e38f9f39a836
"convert@npm:5.0.0":
version: 5.0.0
resolution: "convert@npm:5.0.0"
checksum: 10/a8f88863a45b56b310d33c4872b017941afda114b41474dcc835ba1f319af893b012f99846006399f6a0fefb3a9e29e2b3f944a29153722c5e0efb1c48270b9d
languageName: node
linkType: hard

Expand Down Expand Up @@ -15617,7 +15617,7 @@ __metadata:
ckeditor5-custom-build: "npm:0.0.1"
classnames: "npm:2.5.1"
compression: "npm:1.7.4"
convert: "npm:4.14.1"
convert: "npm:5.0.0"
cross-env: "npm:7.0.3"
d3-hierarchy: "npm:3.1.2"
d3-timer: "npm:3.0.1"
Expand Down

0 comments on commit 15c5085

Please sign in to comment.