44 * @param {string } text Full document text.
55 * @constructor
66 */
7- Document = function ( text ) {
8- text || ( text = '' ) ;
7+ var Document = function ( text ) {
8+ text = text || '' ;
99 this . storage = Document . prepareText ( text ) ;
1010} ;
1111
@@ -55,9 +55,9 @@ Document.prototype.getLine = function(index) {
5555 */
5656Document . prototype . getLength = function ( ) {
5757 var sum = 0 ;
58- for ( var i = this . storage . length - 1 ; i >= 0 ; -- i ) {
59- sum += this . storage [ i ] . length
60- } ;
58+ for ( var i = this . storage . length - 1 ; i >= 0 ; -- i ) {
59+ sum += this . storage [ i ] . length ;
60+ }
6161 return sum ;
6262} ;
6363
@@ -67,8 +67,10 @@ Document.prototype.getLength = function() {
6767 * @return {string|undefined }
6868 */
6969Document . prototype . charAt = function ( column , row ) {
70- var row = this . storage [ row ] ;
71- if ( row ) return row . charAt ( column ) ;
70+ row = this . storage [ row ] ;
71+ if ( row ) {
72+ return row . charAt ( column ) ;
73+ }
7274} ;
7375
7476/**
@@ -85,7 +87,9 @@ Document.prototype.insertText = function(text, column, row) {
8587 // First we calculate new column position because
8688 // text array will be changed in the process
8789 var newColumn = text [ text . length - 1 ] . length ;
88- if ( text . length === 1 ) newColumn += column ;
90+ if ( text . length === 1 ) {
91+ newColumn += column ;
92+ }
8993
9094 // append remainder of the current line to last line in new text
9195 text [ text . length - 1 ] += this . storage [ row ] . substr ( column ) ;
@@ -176,4 +180,4 @@ Document.prototype.deleteChar = function(forward, startColumn, startRow) {
176180 }
177181
178182 return this . deleteRange ( startColumn , startRow , endColumn , endRow ) ;
179- } ;
183+ } ;
0 commit comments