detab

3.0.2last stable release 2 years ago
Complexity Score
Low
Open Issues
0
Dependent Projects
41
Weekly Downloadsglobal
1,524,752

License

  • MIT
    • Yesattribution
    • Permissivelinking
    • Permissivedistribution
    • Permissivemodification
    • Nopatent grant
    • Yesprivate use
    • Permissivesublicensing
    • Notrademark grant

Downloads

Readme

detab

Replace tabs with spaces.

Contents

  • What is this?
  • When should I use this?
  • Install
  • Use
  • API
    • detab(value[, size=4])
  • Types
  • Compatibility
  • Contribute
  • Security
  • License

What is this?

This package can turn a string with tabs into a string with spaces.

When should I use this?

You can use this package if you want to define how big the tab size is.

Install

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>

Use

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

API

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.

Types

This package is fully typed with TypeScript. It exports no additional types.

Compatibility

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.

Contribute

Yes please! See How to Contribute to Open Source.

Security

This package is safe.

License

MIT © Titus Wormer

Dependencies

Loading dependencies...

CVE IssuesActive
0
Scorecards Score
3.10
Test Coverage
100.00%
Follows Semver
Yes
Github Stars
4
Dependenciestotal
8
DependenciesOutdated
6
DependenciesDeprecated
0
Threat Modelling
No
Repo Audits
No

Learn how to distribute detab in your own private NPM registry

npm config set registry  https://npm.cloudsmith.com/owner/repo
Processing...
Done
npm install detab
Processing...
Done

11 Releases

NPM on Cloudsmith

Getting started with NPM on Cloudsmith is fast and easy.