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 8.3.0 to 9.0.0

38

CHANGELOG.md

@@ -1,5 +0,41 @@

# Change Log
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [9.0.0](https://github.com/dsherret/code-block-writer/compare/v7.3.0...v9.0.0) (2019-05-10)
### Bug Fixes
* `isInString()` was not handling escaped string characters. ([a357278](https://github.com/dsherret/code-block-writer/commit/a357278))
* Hide remaining private methods/properties from declaration file. ([5e7aaef](https://github.com/dsherret/code-block-writer/commit/5e7aaef))
* Restrict `newLine` to "\n" | "\r\n". ([699a41f](https://github.com/dsherret/code-block-writer/commit/699a41f))
### Features
* [#24](https://github.com/dsherret/code-block-writer/issues/24) - Add `indent(times)`. ([0108dab](https://github.com/dsherret/code-block-writer/commit/0108dab))
* Add `#withHangingIndentation` ([2c77357](https://github.com/dsherret/code-block-writer/commit/2c77357))
* Add `#withQueuedIndentationLevel` and `#withIndentationLevel`. ([1bcf7c8](https://github.com/dsherret/code-block-writer/commit/1bcf7c8))
### perf
* [#25](https://github.com/dsherret/code-block-writer/issues/25) Improve performance. ([6061b25](https://github.com/dsherret/code-block-writer/commit/6061b25))
### refactor
* Fix spelling mistake in withHangingIdentation and withIdentationLevel method names. ([38d2bf1](https://github.com/dsherret/code-block-writer/commit/38d2bf1))
* Remove `queueIndentationLevel` and `withQueuedIndentationLevel`. Use `withHangingIndentation`. ([ffa2e0f](https://github.com/dsherret/code-block-writer/commit/ffa2e0f))
### BREAKING CHANGES
* Removed `queueIndentationLevel` and `withQueuedIndentationLevel`. Use `withHangingIndentation`.
* Fixed spelling mistake in withHangingIdentation and withIdentationLevel method names.
* Library now targets ES2015 instead of ES5.
<a name="8.3.0"></a>

@@ -6,0 +42,0 @@ # [8.3.0](https://github.com/dsherret/code-block-writer/compare/v8.2.0...v8.3.0) (2019-05-05)

30

dist/code-block-writer.d.ts

@@ -40,30 +40,6 @@ /**

/**
* Queues the indentation level for the next lines written.
* @param indentationLevel - Indentation level to queue.
*/
queueIndentationLevel(indentationLevel: number): this;
/**
* Queues the indentation level for the next lines written using the provided indentation text.
* @param whitespaceText - Gets the indentation level from the indentation text.
*/
queueIndentationLevel(whitespaceText: string): this;
/**
* Queues the indentation level for the next lines written within the provided action
* and restores the writer's indentation state after afterwards.
* @param indentationLevel - Indentation level to queue.
* @param action - Action to perform with the queued indentation.
*/
withQueuedIndentationLevel(indentationLevel: number, action: () => void): this;
/**
* Queues the indentation level for the next lines written using the provided indentation
* text within the provided action and restores the writer's indentation state afterwards.
* @param whitespaceText - Gets the indentation level from the indentation text.
* @param action - Action to perform with the queued indentation.
*/
withQueuedIndentationLevel(whitespaceText: string, action: () => void): this;
/**
* Writes the text within the provided action with hanging indentation.
* @param action - Action to perform with hanging indentation.
*/
withHangingIdentation(action: () => void): this;
withHangingIndentation(action: () => void): this;
/**

@@ -86,3 +62,3 @@ * Sets the current indentation level.

*/
withIdentationLevel(indentationLevel: number, action: () => void): this;
withIndentationLevel(indentationLevel: number, action: () => void): this;
/**

@@ -94,3 +70,3 @@ * Sets the identation level with the provided indentation text within the provided action

*/
withIdentationLevel(whitespaceText: string, action: () => void): this;
withIndentationLevel(whitespaceText: string, action: () => void): this;
/**

@@ -97,0 +73,0 @@ * Gets the current indentation level.

@@ -49,2 +49,3 @@ "use strict";

}
/** @internal */
queueIndentationLevel(countOrText) {

@@ -54,2 +55,3 @@ this._queuedIndentation = this._getIndentationLevelFromArg(countOrText);

}
/** @internal */
withQueuedIndentationLevel(countOrText, action) {

@@ -62,3 +64,3 @@ const previousState = this._getIndentationState();

finally {
this._setIdentationState(previousState);
this._setIndentationState(previousState);
}

@@ -71,3 +73,3 @@ return this;

*/
withHangingIdentation(action) {
withHangingIndentation(action) {
return this.withQueuedIndentationLevel(this.getIndentationLevel() + 1, action);

@@ -79,3 +81,3 @@ }

}
withIdentationLevel(countOrText, action) {
withIndentationLevel(countOrText, action) {
const previousState = this._getIndentationState();

@@ -87,3 +89,3 @@ this.setIndentationLevel(countOrText);

finally {
this._setIdentationState(previousState);
this._setIndentationState(previousState);
}

@@ -523,3 +525,3 @@ return this;

/** @internal */
_setIdentationState(state) {
_setIndentationState(state) {
this._currentIndentation = state.current;

@@ -526,0 +528,0 @@ this._queuedIndentation = state.queued;

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

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

},
"typescript": {
"definition": "code-block-writer.d.ts"
},
"dependencies": {},

@@ -47,0 +44,0 @@ "devDependencies": {

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

}
```
de```

@@ -78,10 +78,6 @@ ## Methods

* `setIndentationLevel(whitespaceText: string)` - Sets the current indentation level based on the provided whitespace text.
* `withIdentationLevel(indentationLevel: number, action: () => void)` - Sets the indentation level within the provided action.
* `withIdentationLevel(whitespaceText: string, action: () => void)` - Sets the indentation level based on the provided whitespace text within the action.
* `withIndentationLevel(indentationLevel: number, action: () => void)` - Sets the indentation level within the provided action.
* `withIndentationLevel(whitespaceText: string, action: () => void)` - Sets the indentation level based on the provided whitespace text within the action.
* `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.
* `withQueuedIdentationLevel(indentationLevel: number, action: () => void)` - Sets the queued indentation level within the provided action.
* `withQueuedIdentationLevel(whitespaceText: string, action: () => void)` - Sets the queued indentation level based on the provided whitespace text within the action.
* `withHangingIdentation(action: () => void)` - Writes the code within the action with hanging indentation.
* `withHangingIndentation(action: () => void)` - Writes the code within the action with hanging indentation.
* `closeComment()` - Writes text to exit a comment if in a comment.

@@ -88,0 +84,0 @@ * `isInComment()` - Gets if the writer is currently in a comment.

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