@bscotch/utility
Advanced tools
Comparing version 0.11.1 to 0.12.0
@@ -7,2 +7,6 @@ /** | ||
/** | ||
* Remove ALL indents, from every line. | ||
*/ | ||
export declare function nodent(strings: TemplateStringsArray, ...interps: any[]): string; | ||
/** | ||
* Remove linebreaks and extra spacing in a template string. | ||
@@ -9,0 +13,0 @@ */ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.oneline = exports.undent = void 0; | ||
exports.oneline = exports.nodent = exports.undent = void 0; | ||
function populateTemplate(strings, ...interps) { | ||
@@ -36,2 +36,16 @@ let string = ''; | ||
/** | ||
* Remove ALL indents, from every line. | ||
*/ | ||
function nodent(strings, ...interps) { | ||
let string = populateTemplate(strings, ...interps); | ||
// Remove initial and final newlines | ||
string = string | ||
.replace(/^[\r\n]+/, '') | ||
.replace(/\s+$/, ''); | ||
return string.split(/\r?\n/g) | ||
.map(line => line.replace(/^\s*(.*?)/, "$1")) | ||
.join("\n"); | ||
} | ||
exports.nodent = nodent; | ||
/** | ||
* Remove linebreaks and extra spacing in a template string. | ||
@@ -38,0 +52,0 @@ */ |
@@ -0,1 +1,10 @@ | ||
# [0.12.0](https://github.com/bscotch/node-util/compare/v0.11.1...v0.12.0) (2021-02-25) | ||
### Features | ||
* Add a 'nodent' tagged template to remove all indentation from a multiline string. ([4029137](https://github.com/bscotch/node-util/commit/4029137ca5ba237e3268dfe2d5789fc78470f427)) | ||
## [0.11.1](https://github.com/bscotch/node-util/compare/v0.11.0...v0.11.1) (2021-02-24) | ||
@@ -2,0 +11,0 @@ |
{ | ||
"name": "@bscotch/utility", | ||
"version": "0.11.1", | ||
"version": "0.12.0", | ||
"description": "Bscotch Utilities: Methods for common Node.js needs.", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -38,3 +38,4 @@ # Bscotch Utilities | ||
undent, | ||
oneline | ||
oneline, | ||
nodent, | ||
} from '@bscotch/utility'; | ||
@@ -62,2 +63,15 @@ | ||
// with the smallest indentation.` | ||
nodent` | ||
All lines will | ||
be un-inindented | ||
completely | ||
but still on separate lines. | ||
`; | ||
// => | ||
//`All lines will | ||
//be un-inindented | ||
//completely | ||
//but still on separate lines.` | ||
``` | ||
@@ -64,0 +78,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59881
680
245