diff --git a/.babelrc b/.babelrc
index d7d3d12e..d055a382 100644
--- a/.babelrc
+++ b/.babelrc
@@ -4,33 +4,42 @@
"presets": ["next/babel"],
"plugins": [
[
- "babel-plugin-inline-react-svg",
- {
- "svgo": {
- "plugins": [
- {
- "name": "removeViewBox",
- "active": false
- }
- ]
- }
+ "babel-plugin-inline-react-svg",
+ {
+ "svgo": {
+ "plugins": [
+ {
+ "name": "removeViewBox",
+ "active": false
+ }]
}
- ],
- [
- "babel-plugin-transform-react-remove-prop-types",
- {
- "mode": "wrap"
- }
- ]
- ]
+ }
+ ],
+ [
+ "babel-plugin-transform-react-remove-prop-types",
+ {
+ "mode": "wrap"
+ }
+ ],
+ "@babel/plugin-proposal-nullish-coalescing-operator",
+ "@babel/plugin-proposal-optional-chaining"
+ ]
},
"development": {
"presets": ["next/babel"],
- "plugins": ["babel-plugin-inline-react-svg"]
+ "plugins": [
+ "babel-plugin-inline-react-svg",
+ "@babel/plugin-proposal-nullish-coalescing-operator",
+ "@babel/plugin-proposal-optional-chaining"
+ ]
},
"test": {
"presets": ["next/babel"],
- "plugins": ["babel-plugin-inline-react-svg"]
+ "plugins": [
+ "babel-plugin-inline-react-svg",
+ "@babel/plugin-proposal-nullish-coalescing-operator",
+ "@babel/plugin-proposal-optional-chaining"
+ ]
}
}
}
diff --git a/package-lock.json b/package-lock.json
index 0c83ee78..b2cd3bcb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2020,9 +2020,9 @@
}
},
"@babel/plugin-proposal-nullish-coalescing-operator": {
- "version": "7.13.8",
- "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.13.8.tgz",
- "integrity": "sha512-iePlDPBn//UhxExyS9KyeYU7RM9WScAG+D3Hhno0PLJebAEpDZMocbDe64eqynhNAnwz/vZoL/q/QB2T1OH39A==",
+ "version": "7.14.2",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.14.2.tgz",
+ "integrity": "sha512-ebR0zU9OvI2N4qiAC38KIAK75KItpIPTpAtd2r4OZmMFeKbKJpUFLYP2EuDut82+BmYi8sz42B+TfTptJ9iG5Q==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.13.0",
@@ -2095,9 +2095,9 @@
}
},
"@babel/plugin-proposal-optional-chaining": {
- "version": "7.13.12",
- "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.13.12.tgz",
- "integrity": "sha512-fcEdKOkIB7Tf4IxrgEVeFC4zeJSTr78no9wTdBuZZbqF64kzllU0ybo2zrzm7gUQfxGhBgq4E39oRs8Zx/RMYQ==",
+ "version": "7.14.2",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.14.2.tgz",
+ "integrity": "sha512-qQByMRPwMZJainfig10BoaDldx/+VDtNcrA7qdNaEOAj6VXud+gfrkA8j4CRAU5HjnWREXqIpSpH30qZX1xivA==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.13.0",
diff --git a/package.json b/package.json
index f3ec6dac..87b47b1c 100644
--- a/package.json
+++ b/package.json
@@ -46,6 +46,8 @@
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.13.0",
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.2",
+ "@babel/plugin-proposal-optional-chaining": "^7.14.2",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.14.1",
"@babel/preset-react": "^7.13.13",
diff --git a/src/api/index.js b/src/api/index.js
index fe527799..75395ca9 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -4,7 +4,7 @@
import jsonFetch from "simple-json-fetch";
-import { isEmptyObject, toQueryString, ObjectNested } from "../libraries";
+import { isEmptyObject, toQueryString } from "../libraries";
import { CONFIG_API, GET, CALLBACK_API, METHODS, POST } from "../constants/Api";
/**
@@ -27,7 +27,7 @@ const request = (args = {}, callback = CALLBACK_API) => {
...CONFIG_API,
...config,
};
- const method = ObjectNested.get(config, "method");
+ const method = config?.method;
/* methods : get or post */
if ("string" !== typeof method) {
diff --git a/src/components/Chart/CommonFilters.js b/src/components/Chart/CommonFilters.js
index c3c63aa7..3a3a44e3 100644
--- a/src/components/Chart/CommonFilters.js
+++ b/src/components/Chart/CommonFilters.js
@@ -6,7 +6,6 @@ import React from "react";
import PropTypes from "prop-types";
import Input from "../Input";
-import { ObjectNested } from "../../libraries";
const CommonFilters = ({ onChange, filters, minFrom, minTo }) => {
return (
@@ -16,7 +15,7 @@ const CommonFilters = ({ onChange, filters, minFrom, minTo }) => {
name="from"
placeholder="From"
min={minFrom}
- value={ObjectNested.get(filters, "from", "")}
+ value={filters?.from ?? ""}
onChange={onChange}
/>
{
name="to"
placeholder="To"
min={minTo}
- value={ObjectNested.get(filters, "to", "")}
+ value={filters?.to ?? ""}
onChange={onChange}
/>
diff --git a/src/components/SimpleStat/Stat.js b/src/components/SimpleStat/Stat.js
index 3e63895d..1f0fc5ce 100644
--- a/src/components/SimpleStat/Stat.js
+++ b/src/components/SimpleStat/Stat.js
@@ -5,14 +5,12 @@
import React from "react";
import PropTypes from "prop-types";
-import { ObjectNested } from "../../libraries";
-
import classes from "./SimpleStat.module.css";
const Stat = ({ stat }) => {
- const label = ObjectNested.get(stat, "label");
- const count = ObjectNested.get(stat, "count");
- const style = ObjectNested.get(stat, "style");
+ const label = stat?.label;
+ const count = stat?.count;
+ const style = stat?.style;
return (
diff --git a/src/containers/ContactReady/index.js b/src/containers/ContactReady/index.js
index ad1ed510..d35350d7 100644
--- a/src/containers/ContactReady/index.js
+++ b/src/containers/ContactReady/index.js
@@ -8,7 +8,6 @@ import React from "react";
import LineChart from "../../components/LineChart";
import { CommonFilters } from "../../components/Chart";
import MetricsTemplate from "../MetricsTemplate";
-import { ObjectNested } from "../../libraries";
import {
mostAndLeast,
normalize,
@@ -18,7 +17,7 @@ import { TEMP_MIN_DATE } from "../../constants/Charts";
import Router from "../../routes";
const handleData = (data) => {
- const localData = ObjectNested.get(data, "timeline", {});
+ const localData = data?.timeline ?? {};
return {
globalStats: mostAndLeast(localData),
chart: normalize(localData, "openIssues"),
@@ -46,9 +45,9 @@ const ContactReady = () => {
{
return (
@@ -16,19 +15,19 @@ const Filters = ({ onChange, filters }) => {
type="date"
name="start"
placeholder="From"
- value={ObjectNested.get(filters, "start", "")}
+ value={filters?.start ?? ""}
onChange={onChange}
/>