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} row The row number to use
* @param {Number} column The column number to use * @param {Number} column The column number to use
* *
*
**/ **/
this.createAnchor = function(row, column) { this.createAnchor = function(row, column) {
return new Anchor(this, row, column); return new Anchor(this, row, column);
@ -105,7 +104,6 @@ var Document = function(text) {
* @param {String} text The text to work with * @param {String} text The text to work with
* @returns {String} A String array, with each index containing a piece of the original `text` string. * @returns {String} A String array, with each index containing a piece of the original `text` string.
* *
*
**/ **/
// check for IE split bug // check for IE split bug
@ -119,14 +117,9 @@ var Document = function(text) {
}; };
this.$detectNewLine = function(text) { this.$detectNewLine = function(text) {
var match = text.match(/^.*?(\r\n|\r|\n)/m); var match = text.match(/^.*?(\r\n|\r|\n)/m);
if (match) { this.$autoNewLine = match ? match[1] : "\n";
this.$autoNewLine = match[1];
} else {
this.$autoNewLine = "\n";
}
}; };
/** /**
@ -135,18 +128,13 @@ var Document = function(text) {
* If `newLineMode == unix`, `\n` is returned. * If `newLineMode == unix`, `\n` is returned.
* If `newLineMode == auto`, the value of `autoNewLine` is returned. * If `newLineMode == auto`, the value of `autoNewLine` is returned.
* *
*
*
*
**/ **/
this.getNewLineCharacter = function() { this.getNewLineCharacter = function() {
switch (this.$newLineMode) { switch (this.$newLineMode) {
case "windows": case "windows":
return "\r\n"; return "\r\n";
case "unix": case "unix":
return "\n"; return "\n";
default: default:
return this.$autoNewLine; return this.$autoNewLine;
} }
@ -158,7 +146,6 @@ var Document = function(text) {
* [Sets the new line mode.]{: #Document.setNewLineMode.desc} * [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} * @param {String} newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
* *
*
**/ **/
this.setNewLineMode = function(newLineMode) { this.setNewLineMode = function(newLineMode) {
if (this.$newLineMode === newLineMode) if (this.$newLineMode === newLineMode)
@ -179,8 +166,6 @@ var Document = function(text) {
* Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`). * Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
* @param {String} text The text to check * @param {String} text The text to check
* *
*
*
**/ **/
this.isNewLine = function(text) { this.isNewLine = function(text) {
return (text == "\r\n" || text == "\r" || text == "\n"); 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 * Returns a verbatim copy of the given line as it is in the document
* @param {Number} row The row index to retrieve * @param {Number} row The row index to retrieve
* *
*
*
**/ **/
this.getLine = function(row) { this.getLine = function(row) {
return this.$lines[row] || ""; return this.$lines[row] || "";
@ -202,8 +185,6 @@ var Document = function(text) {
* @param {Number} firstRow The first row index to retrieve * @param {Number} firstRow The first row index to retrieve
* @param {Number} lastRow The final row index to retrieve * @param {Number} lastRow The final row index to retrieve
* *
*
*
**/ **/
this.getLines = function(firstRow, lastRow) { this.getLines = function(firstRow, lastRow) {
return this.$lines.slice(firstRow, lastRow + 1); return this.$lines.slice(firstRow, lastRow + 1);
@ -318,9 +299,6 @@ var Document = function(text) {
* {row: row, column: 0} * {row: row, column: 0}
* ``` * ```
* *
*
*
*
**/ **/
this.insertLines = function(row, lines) { this.insertLines = function(row, lines) {
if (lines.length == 0) if (lines.length == 0)
@ -417,7 +395,6 @@ var Document = function(text) {
* @param {Range} range A specified Range to remove * @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`. * @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) { this.remove = function(range) {
// clip to document // clip to document
@ -458,7 +435,6 @@ var Document = function(text) {
* @param {Number} endColumn The column to stop removing at * @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. * @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) { this.removeInLine = function(row, startColumn, endColumn) {
if (startColumn == endColumn) if (startColumn == endColumn)
@ -485,7 +461,6 @@ var Document = function(text) {
* @param {Number} lastRow The last row to be removed * @param {Number} lastRow The last row to be removed
* @returns {[String]} Returns all the removed lines. * @returns {[String]} Returns all the removed lines.
* *
*
**/ **/
this.removeLines = function(firstRow, lastRow) { this.removeLines = function(firstRow, lastRow) {
var range = new Range(firstRow, 0, lastRow + 1, 0); var range = new Range(firstRow, 0, lastRow + 1, 0);
@ -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 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. * 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) { this.replace = function(range, text) {
if (text.length == 0 && range.isEmpty()) if (text.length == 0 && range.isEmpty())