detab
Detab: tabs -> spaces.
Installation
npm:
npm install detab
detab is also available for bower,
component, duo,
and for AMD, CommonJS, and globals (uncompressed and
compressed).
Usage
Dependencies.
var detab = require('detab');
Create a normal error and format a string:
var four = detab('\tfoo\nbar\tbaz');
var two = detab('\tfoo\nbar\tbaz', 2);
var eight = detab('\tfoo\nbar\tbaz', 8);
Yields:
foo
bar baz
foo
bar baz
foo
bar baz
API
detab(value[, size])
Replace tabs with spaces, being smart about which column the tab is at
and which size should be used.
Parameters:
value
(string
) — Value with tabs;size
(number
, default: 4
) — Tab-size.
Returns: string
— Value without tabs
License
MIT @ Titus Wormer