Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
detab
Advanced tools
Package description
The detab npm package is a utility for converting tabs in a string to spaces. It is particularly useful when dealing with code or text that needs to be formatted with a consistent number of spaces instead of tabs for better readability or to conform to certain coding standards.
Tab to Space Conversion
Converts all tabs in a string to a specified number of spaces. In this example, each tab is replaced with 4 spaces.
const detab = require('detab');
const textWithTabs = 'Hello\tWorld';
const textWithSpaces = detab(textWithTabs, 4);
console.log(textWithSpaces); // Output: 'Hello World'
This package provides similar functionality to detab by converting tabs to spaces. It allows specifying the number of spaces to replace each tab with, much like detab.
Expand-tabs is another package that converts tabs to spaces. It offers more customization options compared to detab, such as setting different tab sizes for different lines if needed.
As the name suggests, this package also replaces tabs with spaces. It is a simple utility like detab but may have different API or performance characteristics.
Readme
Replace tabs with spaces.
This package can turn a string with tabs into a string with spaces.
You can use this package if you want to define how big the tab size is.
This package is ESM only. In Node.js (version 14.14+, 16.0+), install with npm:
npm install detab
In Deno with esm.sh
:
import {detab} from 'https://esm.sh/detab@3'
In browsers with esm.sh
:
<script type="module">
import {detab} from 'https://esm.sh/detab@3?bundle'
</script>
import {detab} from 'detab'
console.log(detab('\tfoo\nbar\tbaz'))
console.log(detab('\tfoo\nbar\tbaz', 2))
console.log(detab('\tfoo\nbar\tbaz', 8))
Yields:
foo
bar baz
foo
bar baz
foo
bar baz
This package exports the identifier detab
.
There is no default export.
detab(value[, size=4])
Replace tabs with spaces in value
(string
), being smart about which column
the tab is at and which size
(number
, default: 4
) should be used.
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+ and 16.0+. It also works in Deno and modern browsers.
Yes please! See How to Contribute to Open Source.
This package is safe.
FAQs
Detab: tabs -> spaces
The npm package detab receives a total of 1,581,948 weekly downloads. As such, detab popularity was classified as popular.
We found that detab demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.