File tree Expand file tree Collapse file tree 6 files changed +47
-4
lines changed Expand file tree Collapse file tree 6 files changed +47
-4
lines changed Original file line number Diff line number Diff line change 6767 "identity-obj-proxy" : " 3.0.0" ,
6868 "intersection-observer" : " 0.7.0" ,
6969 "js-cookie" : " ^2.2.1" ,
70- "lodash" : " ^4.17.21" ,
7170 "mini-css-extract-plugin" : " 2.5.2" ,
7271 "newrelic" : " ^6.13.0" ,
7372 "node-sass" : " 6.0.1" ,
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ import {
1212} from './universal/service/RenderService' ;
1313import Component from './universal/model/Component' ;
1414import logger from './universal/utils/logger' ;
15- import omit from 'lodash/omit' ;
15+ import omit from './universal/utils/lodash/omit' ;
16+
1617import { getPreviewFile } from './universal/utils/previewHelper' ;
1718
1819const appConfig = require ( '__APP_CONFIG__' ) ;
Original file line number Diff line number Diff line change 1- import omit from 'lodash/omit' ;
21import { isPreview , renderComponent , renderLinksAndScripts } from '../service/RenderService' ;
32import { BLACKLIST_OUTPUT } from '../utils/constants' ;
3+ import omit from '../utils/lodash/omit' ;
44
55export default class Renderer {
66 constructor ( component , context ) {
Original file line number Diff line number Diff line change 11import React from 'react' ;
2- import groupBy from 'lodash/groupBy' ;
32import ReactDOMServer from 'react-dom/server' ;
43import { ServerStyleSheet } from 'styled-components' ;
54
65import partials from './partials' ;
6+ import groupBy from '../../utils/lodash/groupBy' ;
7+
78const STATUS_COLOR = {
89 live : '#8dc63f' ,
910 dev : '#FF6000' ,
Original file line number Diff line number Diff line change 1+ function groupBy ( arr , predicate ) {
2+ return arr . reduce ( ( obj , item ) => {
3+ // Check if the predicate is a function to run on the item or a property of it
4+ const key = predicate
5+ ? typeof predicate === 'function'
6+ ? predicate ( item )
7+ : item [ predicate ]
8+ : item ;
9+
10+ if ( obj && ! obj . hasOwnProperty ( key ) ) {
11+ obj [ key ] = [ ] ;
12+ }
13+
14+ // Push the value to the object
15+ obj [ key ] . push ( item ) ;
16+
17+ // Return the object to the next item in the loop
18+ return obj ;
19+ } , { } ) ;
20+ }
21+
22+ export default groupBy ;
Original file line number Diff line number Diff line change 1+ const keyControl = ( keys , key ) => {
2+ for ( const item in keys ) {
3+ if ( Array . isArray ( keys [ item ] ) ) {
4+ const arrayStatus = keyControl ( keys [ item ] , key ) ;
5+ if ( ! arrayStatus ) {
6+ return false ;
7+ }
8+ }
9+ if ( keys [ item ] === key ) {
10+ return false ;
11+ }
12+ }
13+ return true ;
14+ } ;
15+
16+ function omit ( obj , ...keys ) {
17+ return Object . fromEntries ( Object . entries ( obj ) . filter ( ( [ k ] ) => keyControl ( keys , k ) ) ) ;
18+ }
19+
20+ export default omit ;
You can’t perform that action at this time.
0 commit comments