Skip to content

Commit c80d26d

Browse files
authored
Merge pull request #29 from outbrain/OBPE-7254-remove-fromEntries
Update index.jsx
2 parents 8178536 + 1e0fbe4 commit c80d26d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/index.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import PropTypes from 'prop-types';
22
import React, { useEffect, useRef } from 'react';
33

4-
const removeNullOrEmpty = (obj) => Object.fromEntries(Object.entries(obj).filter(([_, v]) => v != null && v !== ''));
5-
4+
const removeNullOrEmpty = (obj) => {
5+
const o = {};
6+
Object.keys(obj).forEach((key) => obj[key] !== null && obj[key] !== '' && (o[key] = obj[key]));
7+
return o;
8+
};
69
const WidgetContainer = ({ attrs }) => <div className="OUTBRAIN" {...attrs} />;
710

811
const OutbrainWidget = React.memo(({

0 commit comments

Comments
 (0)