UNPKG
dilswer
Version:
canary (1.4.1-canary-2646611d496a22abc293b0483ac4e6e928713eaf.0)
latest (3.2.1)
3.2.1
3.2.0
3.1.1
3.1.0
3.0.2
3.0.1
3.0.0
2.2.0
2.1.1
2.1.0
2.0.2
2.0.1
2.0.0
1.5.0
1.4.1
1.4.1-canary-2646611d496a22abc293b0483ac4e6e928713eaf.0
1.4.0-canary-fa00e65b6ab1731c7d197812e8a49d429c6ad936.0
1.4.0-canary-562f10b27e4ffde47913abec1e2fac876339a50d.0
1.3.0
1.2.1-canary-5917165bb858c854646c4026597974b9ee9c2f7b
1.2.0
1.1.1
1.1.0
1.0.3
1.0.2
1.0.1
Blazingly fast data validation library with TypeScript integration.
github.com/ncpa0/Dilswer
dilswer
/
dist
/
esm
/
ts-type-generator
/
add-indent-to-last-line.mjs
12 lines
(11 loc)
•
299 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
// src/ts-type-generator/add-indent-to-last-line.ts
var addIndentToLastLine = (
str
, indent) => {
const
lastEOL =
str
.
trimEnd
().
lastIndexOf
(
"\n"
);
if
(lastEOL === -
1
) {
return
str
; }
return
str
.
slice
(
0
, lastEOL +
1
) + indent +
str
.
slice
(lastEOL +
1
); }; export { addIndentToLastLine };