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 11.0.0 to 11.0.1

script/mod.js

7

esm/mod.js

@@ -1,3 +0,8 @@

import { CommentChar } from "./comment_char.js";
import { escapeForWithinString, getStringFromStrOrFunc } from "./utils/string_utils.js";
/** @internal */
var CommentChar;
(function (CommentChar) {
CommentChar[CommentChar["Line"] = 0] = "Line";
CommentChar[CommentChar["Star"] = 1] = "Star";
})(CommentChar || (CommentChar = {}));
// Using the char codes is a performance improvement (about 5.5% faster when writing because it eliminates additional string allocations).

@@ -4,0 +9,0 @@ const CHARS = {

14

package.json
{
"module": "./esm/mod.js",
"main": "./umd/mod.js",
"main": "./script/mod.js",
"types": "./types/mod.d.ts",
"name": "code-block-writer",
"version": "11.0.0",
"version": "11.0.1",
"description": "A simple code writer that assists with formatting and visualizing blocks of code.",

@@ -25,6 +25,5 @@ "repository": {

"devDependencies": {
"@types/node": "16.11.1",
"@types/node": "16.11.37",
"chalk": "4.1.2",
"chai": "4.3.4",
"deno.ns": "0.6.4",
"@deno/shim-deno": "~0.6.0",
"@types/chai": "^4.2.22"

@@ -35,3 +34,3 @@ },

"import": "./esm/mod.js",
"require": "./umd/mod.js",
"require": "./script/mod.js",
"types": "./types/mod.d.ts"

@@ -42,6 +41,3 @@ }

"test": "node test_runner.js"
},
"dependencies": {
"tslib": "2.3.1"
}
}

@@ -8,5 +8,5 @@ # code-block-writer

Code writer that assists with formatting and visualizing blocks of JavaScript or TypeScript code.
Code writer for JavaScript or TypeScript code.
With Deno/Browser:
With Deno:

@@ -31,15 +31,14 @@ ```ts

const writer = new CodeBlockWriter({
// optional options
newLine: "\r\n", // default: "\n"
indentNumberOfSpaces: 2, // default: 4
useTabs: false, // default: false
useSingleQuote: true // default: false
// optional options
newLine: "\r\n", // default: "\n"
indentNumberOfSpaces: 2, // default: 4
useTabs: false, // default: false
useSingleQuote: true // default: false
});
const className = "MyClass";
writer.write(`class ${className} extends OtherClass`).block(() => {
writer.writeLine(`@MyDecorator(1, 2)`);
writer.write(`myMethod(myParam: any)`).block(() => {
writer.write("return this.post(").quote("myArgument").write(");");
});
writer.write("class MyClass extends OtherClass").block(() => {
writer.writeLine(`@MyDecorator(1, 2)`);
writer.write(`myMethod(myParam: any)`).block(() => {
writer.write("return this.post(").quote("myArgument").write(");");
});
});

@@ -52,3 +51,5 @@

```text
<!-- dprint-ignore -->
```js
class MyClass extends OtherClass {

@@ -55,0 +56,0 @@ @MyDecorator(1, 2)

Sorry, the diff of this file is not supported yet

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