Socket
Socket
Sign inDemoInstall

code-block-writer

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code-block-writer - npm Package Compare versions

Comparing version 7.2.2 to 7.3.0

yarn-error.log

15

CHANGELOG.md

@@ -5,2 +5,17 @@ # Change Log

<a name="7.3.0"></a>
# [7.3.0](https://github.com/dsherret/code-block-writer/compare/v7.2.2...v7.3.0) (2019-03-16)
### Bug Fixes
* Should not write space on block if last was a newline. ([37706b9](https://github.com/dsherret/code-block-writer/commit/37706b9))
### Features
* [#23](https://github.com/dsherret/code-block-writer/issues/23) - Add closeComment(). ([cf9f722](https://github.com/dsherret/code-block-writer/commit/cf9f722))
<a name="7.2.2"></a>

@@ -7,0 +22,0 @@ ## [7.2.2](https://github.com/dsherret/code-block-writer/compare/v7.2.1...v7.2.2) (2018-09-27)

12

dist/code-block-writer.d.ts

@@ -32,5 +32,5 @@ export interface Options {

* Queues the indentation level for the next lines written using the provided indentation text.
* @param indentationText - Gets the indentation level from the indentation text.
* @param whitespaceText - Gets the indentation level from the indentation text.
*/
queueIndentationLevel(indentationText: string): this;
queueIndentationLevel(whitespaceText: string): this;
/**

@@ -43,5 +43,5 @@ * Sets the current indentation level.

* Sets the current indentation using the provided indentation text.
* @param indentationText - Gets the indentation level from the indentation text.
* @param whitespaceText - Gets the indentation level from the indentation text.
*/
setIndentationLevel(indentationText: string): this;
setIndentationLevel(whitespaceText: string): this;
/**

@@ -159,2 +159,6 @@ * Gets the current indentation level.

/**
* Writes text to exit a comment if in a comment.
*/
closeComment(): this;
/**
* Gets the length of the string in the writer.

@@ -161,0 +165,0 @@ */

@@ -53,3 +53,4 @@ "use strict";

this._newLineIfNewLineOnNextWrite();
this.spaceIfLastNot();
if (this.getLength() > 0 && !this.isLastNewLine())
this.spaceIfLastNot();
this.inlineBlock(block);

@@ -221,2 +222,22 @@ this._newLineOnNextWrite = true;

/**
* Writes text to exit a comment if in a comment.
*/
CodeBlockWriter.prototype.closeComment = function () {
var commentChar = this._currentCommentChar;
switch (commentChar) {
case CommentChar_1.CommentChar.Line:
this.newLine();
break;
case CommentChar_1.CommentChar.Star:
if (!this.isLastNewLine())
this.spaceIfLastNot();
this.write("*/");
break;
default:
var assertUndefined = commentChar;
break;
}
return this;
};
/**
* Gets the length of the string in the writer.

@@ -223,0 +244,0 @@ */

{
"name": "code-block-writer",
"version": "7.2.2",
"version": "7.3.0",
"description": "A simple code writer that assists with formatting and visualizing blocks of code.",

@@ -5,0 +5,0 @@ "main": "dist/code-block-writer.js",

@@ -55,3 +55,3 @@ code-block-writer

* `getLength()` - Get the current number of characters.
* `writeLine(str: string)` - Writes some text and adds a newline.
* `writeLine(text: string)` - Writes some text and adds a newline.
* `newLine()` - Writes a newline.

@@ -77,4 +77,7 @@ * `newLineIfLastNot()` - Writes a newline if what was written last wasn't a newline.

* `setIndentationLevel(indentationLevel: number)` - Sets the current indentation level.
* `setIndentationLevel(whitespaceText: string)` - Sets the current indentation level based on the provided whitespace text.
* `getIndentationLevel()` - Gets the current indentation level.
* `queueIndentationLevel(indentationLevel: number)` - Queues an indentation level to be used once a new line is written.
* `queueIndentationLevel(whitespaceText: string)` - Queues an indentation level to be used once a new line is written based on the provided whitespace text.
* `closeComment()` - Writes text to exit a comment if in a comment.
* `isInComment()` - Gets if the writer is currently in a comment.

@@ -91,1 +94,6 @@ * `isAtStartOfFirstLineOfBlock()` - Gets if the writer is currently at the start of the first line of the text, block, or indentation block.

* `toString()` - Gets the string.
## Other Features
* Does not indent within strings.
* Escapes newlines within double and single quotes created with `.quote(text)`.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc