Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

code-block-writer

Package Overview
Dependencies
Maintainers
1
Versions
86
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 6.3.0 to 6.3.1

10

CHANGELOG.md

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

<a name="6.3.1"></a>
## [6.3.1](https://github.com/dsherret/code-block-writer/compare/v6.3.0...v6.3.1) (2018-02-27)
### Bug Fixes
* Include js docs. ([c01c697](https://github.com/dsherret/code-block-writer/commit/c01c697))
<a name="6.3.0"></a>

@@ -7,0 +17,0 @@ # [6.3.0](https://github.com/dsherret/code-block-writer/compare/v6.2.0...v6.3.0) (2018-02-27)

@@ -19,24 +19,107 @@ export default class CodeBlockWriter {

});
/**
* Queues the indentation level for the next lines written.
* @param indentationLevel - Indentation level to be at.
*/
queueIndentationLevel(indentationLevel: number): this;
/**
* Queues the indentation level for the next lines written using the provided indentation text.
* @param indentationText - Gets the indentation level from the indentation text.
*/
queueIndentationLevel(indentationText: string): this;
/**
* Sets the current indentation level.
* @param indentationLevel - Indentation level to be at.
*/
setIndentationLevel(indentationLevel: number): this;
/**
* Sets the current indentation using the provided indentation text.
* @param indentationText - Gets the indentation level from the indentation text.
*/
setIndentationLevel(indentationText: string): this;
/**
* @internal
*/
setIndentationLevel(countOrText: string | number): this;
/**
* Writes a block using braces.
* @param block - Write using the writer within this block.
*/
block(block?: () => void): this;
/**
* Writes an inline block with braces.
* @param block - Write using the writer within this block.
*/
inlineBlock(block?: () => void): this;
/**
* Conditionally writes a line of text.
* @param condition - Condition to evaluate.
* @param str - String to write if the condition is true.
*/
conditionalWriteLine(condition: boolean | undefined, str: string): this;
/**
* Writes a line of text.
* @param str - String to write.
*/
writeLine(str: string): this;
/**
* Writes a newline if the last line was not a newline.
*/
newLineIfLastNotNewLine(): this;
/**
* Writes a blank line.
*/
blankLine(): this;
/**
* Indents the code one level for the current line.
*/
indent(): this;
/**
* Writes a newline if the condition is true.
* @param condition - Condition to evaluate.
*/
conditionalNewLine(condition: boolean | undefined): this;
/**
* Writes a newline.
*/
newLine(): this;
/**
* Writes a quote character.
*/
quote(): this;
/**
* Writes text surrounded in quotes.
* @param text - Text to write.
*/
quote(text: string): this;
/**
* Writes a space if the last character was not a space.
*/
spaceIfLastNotSpace(): this;
/**
* Writes the provided text if the condition is true.
* @param condition - Condition to evaluate.
* @param text - Text to write.
*/
conditionalWrite(condition: boolean | undefined, text: string): this;
/**
* Writes the provided text.
* @param text - Text to write.
*/
write(text: string): this;
/**
* Gets the length of the string in the writer.
*/
getLength(): number;
/**
* Gets if the writer is currently in a comment.
*/
isInComment(): boolean;
/**
* Gets if the writer is currently in a string.
*/
isInString(): boolean;
/**
* Gets the writer's text.
*/
toString(): string;

@@ -43,0 +126,0 @@ private writeIndentingNewLines(text);

59

dist/code-block-writer.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var CommentChar_1 = require("./CommentChar");
var CodeBlockWriter = (function () {
var CodeBlockWriter = /** @class */ (function () {
function CodeBlockWriter(opts) {

@@ -25,2 +25,6 @@ this._currentIndentation = 0;

};
/**
* Writes a block using braces.
* @param block - Write using the writer within this block.
*/
CodeBlockWriter.prototype.block = function (block) {

@@ -33,2 +37,6 @@ this.newLineIfNewLineOnNextWrite();

};
/**
* Writes an inline block with braces.
* @param block - Write using the writer within this block.
*/
CodeBlockWriter.prototype.inlineBlock = function (block) {

@@ -46,2 +54,7 @@ this.newLineIfNewLineOnNextWrite();

};
/**
* Conditionally writes a line of text.
* @param condition - Condition to evaluate.
* @param str - String to write if the condition is true.
*/
CodeBlockWriter.prototype.conditionalWriteLine = function (condition, str) {

@@ -52,2 +65,6 @@ if (condition)

};
/**
* Writes a line of text.
* @param str - String to write.
*/
CodeBlockWriter.prototype.writeLine = function (str) {

@@ -61,2 +78,5 @@ this.newLineIfNewLineOnNextWrite();

};
/**
* Writes a newline if the last line was not a newline.
*/
CodeBlockWriter.prototype.newLineIfLastNotNewLine = function () {

@@ -68,5 +88,11 @@ this.newLineIfNewLineOnNextWrite();

};
/**
* Writes a blank line.
*/
CodeBlockWriter.prototype.blankLine = function () {
return this.newLineIfLastNotNewLine().newLine();
};
/**
* Indents the code one level for the current line.
*/
CodeBlockWriter.prototype.indent = function () {

@@ -76,2 +102,6 @@ this.newLineIfNewLineOnNextWrite();

};
/**
* Writes a newline if the condition is true.
* @param condition - Condition to evaluate.
*/
CodeBlockWriter.prototype.conditionalNewLine = function (condition) {

@@ -82,2 +112,5 @@ if (condition)

};
/**
* Writes a newline.
*/
CodeBlockWriter.prototype.newLine = function () {

@@ -93,2 +126,5 @@ this._newLineOnNextWrite = false;

};
/**
* Writes a space if the last character was not a space.
*/
CodeBlockWriter.prototype.spaceIfLastNotSpace = function () {

@@ -101,2 +137,7 @@ this.newLineIfNewLineOnNextWrite();

};
/**
* Writes the provided text if the condition is true.
* @param condition - Condition to evaluate.
* @param text - Text to write.
*/
CodeBlockWriter.prototype.conditionalWrite = function (condition, text) {

@@ -107,2 +148,6 @@ if (condition)

};
/**
* Writes the provided text.
* @param text - Text to write.
*/
CodeBlockWriter.prototype.write = function (text) {

@@ -113,11 +158,23 @@ this.newLineIfNewLineOnNextWrite();

};
/**
* Gets the length of the string in the writer.
*/
CodeBlockWriter.prototype.getLength = function () {
return this._text.length;
};
/**
* Gets if the writer is currently in a comment.
*/
CodeBlockWriter.prototype.isInComment = function () {
return this._currentCommentChar !== undefined;
};
/**
* Gets if the writer is currently in a string.
*/
CodeBlockWriter.prototype.isInString = function () {
return this._stringCharStack.length > 0 && this._stringCharStack[this._stringCharStack.length - 1] !== "{";
};
/**
* Gets the writer's text.
*/
CodeBlockWriter.prototype.toString = function () {

@@ -124,0 +181,0 @@ return this._text;

2

package.json
{
"name": "code-block-writer",
"version": "6.3.0",
"version": "6.3.1",
"description": "A simple code writer that assists with formatting and visualizing blocks of code.",

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

@@ -7,3 +7,3 @@ {

"sourceMap": false,
"removeComments": true,
"removeComments": false,
"experimentalDecorators": true,

@@ -10,0 +10,0 @@ "outDir": "dist",

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