@@ -3,18 +3,14 @@ const helpers = require('./../utils/helpers');
33const NEWLINE = require ( 'os' ) . EOL ;
44const LUResource = require ( './luResource' ) ;
55const LUSectionTypes = require ( '../utils/enums/lusectiontypes' ) ;
6- const { cloneDeepWith, cloneDeep, isFunction} = require ( 'lodash' ) ;
76
87class SectionOperator {
98
109 /**
1110 * @param {LUResource } luresource
1211 */
1312 constructor ( luresource ) {
14- const { Sections, Errors, Content } = cloneDeepWith ( luresource , ( value ) => {
15- return isFunction ( value ) ? undfined : cloneDeep ( value ) ;
16- } ) ;
17- this . Luresource = new LUResource ( Sections , Content , Errors ) ;
13+ this . Luresource = JSON . parse ( JSON . stringify ( luresource ) ) ;
1814 }
1915
2016 // After CRUD, section Ids will keep same unless you change section name.
@@ -42,9 +38,6 @@ class SectionOperator {
4238 this . Luresource . Errors . push ( ...newResource . Errors ) ;
4339
4440 luParser . extractSectionBody ( this . Luresource . Sections , this . Luresource . Content ) ;
45- if ( this . Luresource . hashATNConfig ) {
46- console . log ( '----------------------------' ) ;
47- }
4841 return this . Luresource ;
4942 }
5043
@@ -81,9 +74,6 @@ class SectionOperator {
8174 this . adjustRangeForUpdateSection ( sectionIndex , newResource . Sections ) ;
8275
8376 luParser . extractSectionBody ( this . Luresource . Sections , this . Luresource . Content ) ;
84- if ( this . Luresource . hashATNConfig ) {
85- console . log ( '----------------------------' ) ;
86- }
8777 return this . Luresource ;
8878 }
8979
@@ -106,9 +96,6 @@ class SectionOperator {
10696 const offset = endLine - startLine + 1 ;
10797 this . adjustRangeForDeleteSection ( sectionIndex , offset ) ;
10898 luParser . extractSectionBody ( this . Luresource . Sections , this . Luresource . Content ) ;
109- if ( this . Luresource . hashATNConfig ) {
110- console . log ( '----------------------------' ) ;
111- }
11299 return this . Luresource ;
113100 }
114101
@@ -146,9 +133,6 @@ class SectionOperator {
146133 this . adjustRangeForInsertSection ( sectionIndex , newResource . Sections ) ;
147134
148135 luParser . extractSectionBody ( this . Luresource . Sections , this . Luresource . Content ) ;
149- if ( this . Luresource . hashATNConfig ) {
150- console . log ( '----------------------------' ) ;
151- }
152136 return this . Luresource ;
153137 }
154138
0 commit comments