MCPcopy Create free account
hub / github.com/CommE2E/comm / hasMinStateVersion

Function hasMinStateVersion

lib/shared/version-utils.js:56–76  ·  view source on GitHub ↗
(
  platformDetails: ?PlatformDetails,
  minStateVersion: Partial<{ +native: number, +web: number }>,
)

Source from the content-addressed store, hash-verified

54}
55
56function hasMinStateVersion(
57 platformDetails: ?PlatformDetails,
58 minStateVersion: Partial<{ +native: number, +web: number }>,
59): boolean {
60 if (!platformDetails) {
61 return true;
62 }
63 const { stateVersion } = platformDetails;
64 const minVersion = isWebPlatform(platformDetails.platform)
65 ? minStateVersion.web
66 : minStateVersion.native;
67
68 if (!minVersion) {
69 return true;
70 }
71 if (!stateVersion || stateVersion < minVersion) {
72 return false;
73 }
74
75 return true;
76}
77
78function extractMajorDesktopVersion(desktopVersion: string): number {
79 return desktopVersion.split('.').map(Number)[0];

Callers 2

validateInputFunction · 0.90
validateOutputFunction · 0.90

Calls 1

isWebPlatformFunction · 0.90

Tested by

no test coverage detected