包详细信息

expandtabs

bet4it6MIT1.0.0

Javascript version of expandtabs

自述文件

expandtabs Build Status XO: Linted

Javascript version of expandtabs

Return a copy where all tab characters are expanded using spaces.

This code bases on an article in Chris West's Blog : JavaScript – String.prototype.expandTabs() Revisited.

Support fullwidth characters and ANSI escape codes.

Install

$ npm install expandtabs

Usage

const expandTabs = require('expandtabs');

expandTabs('aaa\tbbb');
//=> aaa        bbb

API

expandTabs(string, tabSize?)

string

Type: string

String need to be expanded.

tabSize

Type: number
Default: 8

Size of a tab.