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 9.2.1 to 9.3.0

10

CHANGELOG.md

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

<a name="9.3.0"></a>
# [9.3.0](https://github.com/dsherret/code-block-writer/compare/v9.2.1...v9.3.0) (2019-06-09)
### Features
* Add `#endsWith(text: string)` ([460e007](https://github.com/dsherret/code-block-writer/commit/460e007))
<a name="9.2.1"></a>

@@ -7,0 +17,0 @@ ## [9.2.1](https://github.com/dsherret/code-block-writer/compare/v9.2.0...v9.2.1) (2019-05-31)

@@ -239,2 +239,7 @@ /**

/**
* Gets if the writer ends with the provided text.
* @param text - Text to check if the writer ends with the provided text.
*/
endsWith(text: string): boolean;
/**
* Iterates over the writer characters in reverse order. The iteration stops when a non-null or

@@ -241,0 +246,0 @@ * undefined value is returned from the action. The returned value is then returned by the method.

@@ -366,2 +366,16 @@ "use strict";

/**
* Gets if the writer ends with the provided text.
* @param text - Text to check if the writer ends with the provided text.
*/
endsWith(text) {
const length = this._length;
return this.iterateLastChars((char, index) => {
const offset = length - index;
const textIndex = text.length - offset;
if (text[textIndex] !== char)
return false;
return textIndex === 0 ? true : undefined;
}) || false;
}
/**
* Iterates over the writer characters in reverse order. The iteration stops when a non-null or

@@ -368,0 +382,0 @@ * undefined value is returned from the action. The returned value is then returned by the method.

2

package.json
{
"name": "code-block-writer",
"version": "9.2.1",
"version": "9.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",

@@ -94,2 +94,3 @@ code-block-writer

* `getLastChar()` - Gets the last character written.
* `endsWith(text: string)` - Gets if the writer ends with the provided text.
* `iterateLastChars<T>(action: (char: string, index: number) => T | undefined): T | undefined` - Iterates over the writer's characters in reverse order, stopping once a non-null or undefined value is returned and returns that value.

@@ -96,0 +97,0 @@ * `getOptions()` - Gets the writer options.

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