code style

This commit is contained in:
nightwing 2013-05-01 16:34:14 +04:00
commit 59f4c367dd

View file

@ -92,7 +92,6 @@ var Document = function(text) {
* @param {Number} row The row number to use
* @param {Number} column The column number to use
*
*
**/
this.createAnchor = function(row, column) {
return new Anchor(this, row, column);
@ -105,7 +104,6 @@ var Document = function(text) {
* @param {String} text The text to work with
* @returns {String} A String array, with each index containing a piece of the original `text` string.
*
*
**/
// check for IE split bug
@ -119,14 +117,9 @@ var Document = function(text) {
};
this.$detectNewLine = function(text) {
var match = text.match(/^.*?(\r\n|\r|\n)/m);
if (match) {
this.$autoNewLine = match[1];
} else {
this.$autoNewLine = "\n";
}
this.$autoNewLine = match ? match[1] : "\n";
};
/**
@ -134,19 +127,14 @@ var Document = function(text) {
* @returns {String} If `newLineMode == windows`, `\r\n` is returned.
* If `newLineMode == unix`, `\n` is returned.
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
*
*
*
*
**/
this.getNewLineCharacter = function() {
switch (this.$newLineMode) {
case "windows":
return "\r\n";
case "unix":
return "\n";
default:
return this.$autoNewLine;
}
@ -157,7 +145,6 @@ var Document = function(text) {
/**
* [Sets the new line mode.]{: #Document.setNewLineMode.desc}
* @param {String} newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
*
*
**/
this.setNewLineMode = function(newLineMode) {
@ -179,8 +166,6 @@ var Document = function(text) {
* Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
* @param {String} text The text to check
*
*
*
**/
this.isNewLine = function(text) {
return (text == "\r\n" || text == "\r" || text == "\n");
@ -190,8 +175,6 @@ var Document = function(text) {
* Returns a verbatim copy of the given line as it is in the document
* @param {Number} row The row index to retrieve
*
*
*
**/
this.getLine = function(row) {
return this.$lines[row] || "";
@ -202,8 +185,6 @@ var Document = function(text) {
* @param {Number} firstRow The first row index to retrieve
* @param {Number} lastRow The final row index to retrieve
*
*
*
**/
this.getLines = function(firstRow, lastRow) {
return this.$lines.slice(firstRow, lastRow + 1);
@ -318,9 +299,6 @@ var Document = function(text) {
* {row: row, column: 0}
* ```
*
*
*
*
**/
this.insertLines = function(row, lines) {
if (lines.length == 0)
@ -417,7 +395,6 @@ var Document = function(text) {
* @param {Range} range A specified Range to remove
* @returns {Object} Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
*
*
**/
this.remove = function(range) {
// clip to document
@ -458,7 +435,6 @@ var Document = function(text) {
* @param {Number} endColumn The column to stop removing at
* @returns {Object} Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.<br/>If `startColumn` is equal to `endColumn`, this function returns nothing.
*
*
**/
this.removeInLine = function(row, startColumn, endColumn) {
if (startColumn == endColumn)
@ -484,7 +460,6 @@ var Document = function(text) {
* @param {Number} firstRow The first row to be removed
* @param {Number} lastRow The last row to be removed
* @returns {[String]} Returns all the removed lines.
*
*
**/
this.removeLines = function(firstRow, lastRow) {
@ -532,7 +507,6 @@ var Document = function(text) {
* If the text and range are empty, this function returns an object containing the current `range.start` value.
* If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
*
*
**/
this.replace = function(range, text) {
if (text.length == 0 && range.isEmpty())