Skip to content

Commit

Permalink
feat: disable rem warnings for prod env
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-kallavus committed Dec 2, 2020
1 parent 4f7ae44 commit 46c9839
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/utils/src/rem/rem.ts
Expand Up @@ -25,9 +25,10 @@ const EXCEPTIONS = [
];

const rem = (value: string | number, baseFontSize: string | number = 16) => {
const isAlloved = EXCEPTIONS.includes(value);
const isDivisibleBy4 = typeof value === 'number' && value % 4 === 0;
if (!(isAlloved || isDivisibleBy4)) {
const isNotAlloved = !EXCEPTIONS.includes(value);
const isNotDivisibleBy4 = !(typeof value === 'number' && value % 4 === 0);
const isNotProduction = process.env.NODE_ENV !== 'production';
if (isNotAlloved && isNotDivisibleBy4 && isNotProduction) {
// eslint-disable-next-line no-console
console.warn(
`ATTENTION! You've used rem(${value}) which is out of Moon DS range! Please check documentation.`
Expand Down

0 comments on commit 46c9839

Please sign in to comment.