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

@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { compare } from 'compare-versions';
import { isEmpty } from 'ramda';
import { compareVersions } from './utils';
const propTypes = {
minVersion: PropTypes.string.isRequired,
@@ -10,7 +10,7 @@ const propTypes = {
};
const ForVersion = ({ minVersion, currentServerVersion, children }) =>
isEmpty(currentServerVersion) || compare(minVersion, currentServerVersion, '>')
isEmpty(currentServerVersion) || compareVersions(currentServerVersion, '<', minVersion)
? null
: <React.Fragment>{children}</React.Fragment>;