Defined custom function to compare versions which defines the operator in the middle

This commit is contained in:
Alejandro Celaya
2019-10-05 11:03:17 +02:00
parent 354d19af1b
commit ce9ecd7b93
3 changed files with 12 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ import marker from 'leaflet/dist/images/marker-icon.png';
import markerShadow from 'leaflet/dist/images/marker-shadow.png';
import { range } from 'ramda';
import { useState } from 'react';
import { compare } from 'compare-versions';
const TEN_ROUNDING_NUMBER = 10;
const DEFAULT_TIMEOUT_DELAY = 2000;
@@ -53,3 +54,9 @@ export const useToggle = (initialValue = false) => {
};
export const wait = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
export const compareVersions = (firstVersion, operator, secondVersion) => compare(
firstVersion,
secondVersion,
operator
);