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

ts-dedent

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-dedent - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

esm/index.d.ts

13

dist/index.js

@@ -25,3 +25,14 @@ "use strict";

values.forEach(function (value, i) {
string += value + strings[i + 1];
var endentations = string.match(/(?:^|\n)( *)$/);
var endentation = endentations ? endentations[1] : '';
var indentedValue = value;
if (typeof value === 'string' && value.includes('\n')) {
indentedValue = String(value)
.split('\n')
.map(function (str, i) {
return i === 0 ? str : "" + endentation + str;
})
.join('\n');
}
string += indentedValue + strings[i + 1];
});

@@ -28,0 +39,0 @@ return string;

@@ -7,2 +7,10 @@ # History

## v2.2.0
Add indentation to values with multiline strings & added ESM module
- Updated all dependencies to their latest version
- Updated CI settings (added node 16, multiple os platforms)
- Moved from Travis CI to Github Actions
## v2.1.1

@@ -9,0 +17,0 @@

23

package.json
{
"name": "ts-dedent",
"version": "2.1.1",
"version": "2.2.0",
"description": "TypeScript package which smartly trims and strips indentation from multi-line strings",
"author": "Tamino Martinius <dev@zaku.eu>",
"main": "./dist/index.js",
"module": "./dist/index.js",
"module": "./esm/index.js",
"jsnext:main": "./dist/index.js",

@@ -13,2 +13,3 @@ "typings": "./dist/index.d.ts",

"dist",
"esm",
"src"

@@ -43,14 +44,14 @@ ],

"ci": "npm run coverage && codecov",
"compile": "rm -rf dist/* && tsc",
"compile": "rm -rf dist/* && rm -rf esm/* && tsc --module commonjs --outdir dist && tsc --module es6 --outdir esm",
"preversion": "npm run compile && git add ."
},
"devDependencies": {
"@types/jest": "^26.0.22",
"@typescript-eslint/eslint-plugin": "^4.20.0",
"@typescript-eslint/parser": "^4.20.0",
"codecov": "^3.8.1",
"eslint": "^7.23.0",
"jest": "^26.6.3",
"ts-jest": "^26.5.4",
"typescript": "~4.2.3"
"@types/jest": "^26.0.24",
"@typescript-eslint/eslint-plugin": "^4.28.5",
"@typescript-eslint/parser": "^4.28.5",
"codecov": "^3.8.3",
"eslint": "^7.32.0",
"jest": "^27.0.6",
"ts-jest": "^27.0.4",
"typescript": "~4.3.5"
},

@@ -57,0 +58,0 @@ "jest": {

# TypeScript Dedent
[![Build Status](https://travis-ci.org/tamino-martinius/node-ts-dedent.svg?branch=master)](https://travis-ci.org/tamino-martinius/node-ts-dedent)
[![codecov](https://codecov.io/gh/tamino-martinius/node-ts-dedent/branch/master/graph/badge.svg)](https://codecov.io/gh/tamino-martinius/node-ts-dedent)

@@ -102,2 +101,3 @@

- `2.2.0` **2021-08-01** Add indentation to values with multiline strings & added ESM module
- `2.1.1` **2021-03-31** Update dependencies

@@ -104,0 +104,0 @@ - `2.1.0` **2021-03-24** Bugfixes

@@ -38,3 +38,17 @@ export function dedent(

values.forEach((value, i) => {
string += value + strings[i + 1];
// 5.1 Read current indentation level
const endentations = string.match(/(?:^|\n)( *)$/)
const endentation = endentations ? endentations[1] : ''
let indentedValue = value
// 5.2 Add indentation to values with multiline strings
if (typeof value === 'string' && value.includes('\n')) {
indentedValue = String(value)
.split('\n')
.map((str, i) => {
return i === 0 ? str : `${endentation}${str}`
})
.join('\n');
}
string += indentedValue + strings[i + 1];
});

@@ -41,0 +55,0 @@

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