Gathering detailed insights and metrics for trim-lines
Gathering detailed insights and metrics for trim-lines
Gathering detailed insights and metrics for trim-lines
Gathering detailed insights and metrics for trim-lines
trim-trailing-lines
Remove final line feeds from a string
trim-leading-lines
Trim leading lines from a string when they are 100% whitespace or empty.
trim-off-newlines
Similar to String#trim() but removes only newlines
rollup-plugin-cleanup
Rollup plugin to trim trailing spaces, compact empty lines, and normalize line endings
npm install trim-lines
Typescript
Module System
Node Version
NPM Version
99.6
Supply Chain
99.4
Quality
75.5
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
51 Stars
67 Commits
2 Forks
3 Watchers
1 Branches
3 Contributors
Updated on Jan 25, 2025
Latest Version
3.0.1
Package Id
trim-lines@3.0.1
Unpacked Size
7.32 kB
Size
3.17 kB
File Count
5
NPM Version
8.9.0
Node Version
18.2.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Remove spaces and tabs around line breaks.
This package is a tiny utility that removes spaces and tabs around line endings, keeping the line endings, and not removing whitespace at the start or end of the string. It might look trivial, but it’s actually pretty complex to get performant.
When you need to trim markdown-like whitespace around line endings and don’t want to run into performance problems.
This package is ESM only. In Node.js (version 14.14+, 16.0+, or 18.0+), install with npm:
1npm install trim-lines
In Deno with esm.sh
:
1import trimLines from 'https://esm.sh/trim-lines@3'
In browsers with esm.sh
:
1<script type="module"> 2 import trimLines from 'https://esm.sh/trim-lines@3?bundle' 3</script>
1import {trimLines} from 'trim-lines'
2
3console.log(trimLines(' foo\t\n\n bar \n\tbaz ')) // => ' foo\n\nbar\nbaz '
This package exports the identifier trimLines
.
There is no default export.
trimLines(value)
Remove spaces and tabs around line breaks in value
(string
).
This package is fully typed with TypeScript. It exports no additional types.
This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 14.14+, 16.0+, and 18.0+. It also works in Deno and modern browsers.
Yes please! See How to Contribute to Open Source.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More