Skip to content

Commit

Permalink
Merge pull request #36 from emreyalvac/fix/lodash-removed
Browse files Browse the repository at this point in the history
Fix: Lodash dep. removed and replaced with native functions
  • Loading branch information
oguzhanaslan authored Feb 7, 2022
2 parents 91cc80c + 2049fd5 commit 7ca9c42
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "voltranjs",
"version": "1.0.23",
"version": "1.0.24",
"main": "src/index.js",
"author": "Hepsiburada Technology Team",
"bin": {
Expand Down Expand Up @@ -63,7 +63,6 @@
"identity-obj-proxy": "3.0.0",
"intersection-observer": "0.7.0",
"js-cookie": "^2.2.1",
"lodash": "4.17.19",
"mini-css-extract-plugin": "0.4.4",
"newrelic": "^6.13.0",
"node-sass": "4.14.1",
Expand Down
4 changes: 1 addition & 3 deletions src/universal/core/route/routeConstants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import values from 'lodash/values';

const components = require('__V_COMPONENTS__');

const ROUTE_PATHS = {};
Expand All @@ -15,6 +13,6 @@ Object.keys(components.default).forEach(path => {
};
});

const ROUTE_PATH_ARRAY = values(ROUTE_PATHS);
const ROUTE_PATH_ARRAY = Object.values(ROUTE_PATHS);

export { ROUTE_PATHS, ROUTE_PATH_ARRAY, ROUTE_CONFIGS };
6 changes: 3 additions & 3 deletions src/universal/partials/Welcome/PartialList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import groupBy from 'lodash/groupBy';
import structUtils from '../../utils/struct';
import ReactDOMServer from 'react-dom/server';
import { ServerStyleSheet } from 'styled-components';

Expand All @@ -9,11 +9,11 @@ import partials from './partials';
const sheet = new ServerStyleSheet();

const Welcome = () => {
const { live = [], dev = [], page = [] } = groupBy(partials, item => item.status);
const { live = [], dev = [], page = [] } = structUtils.groupBy(partials, item => item.status);

const renderItem = item => (
<ListItem>
<Link href={item.previewUrl ? item.previewUrl : `${item.url}?preview`} target="_blank">
<Link href={item.previewUrl ? item.previewUrl : `${item.url}?preview`} target='_blank'>
<Name>{item.name}</Name>
<Url>{item.url}</Url>
<Footer>
Expand Down
18 changes: 18 additions & 0 deletions src/universal/utils/struct.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// eslint-disable-next-line import/prefer-default-export
const structUtils = {
groupBy(list, getFn) {
const map = {};
list.map(item => {
const key = getFn(item);
const collection = map[key];
if (!collection) {
map[key] = [item];
} else {
collection.push(item);
}
});
return map;
}
};

export default structUtils;

0 comments on commit 7ca9c42

Please sign in to comment.