remove-tabs
v0.1.0
Published
Remove tabs which are added between multi-line template strings by using tagged
Downloads
4
Maintainers
Readme
remove-tabs
Remove tabs which are added between multi-line template strings by using tagged
Install
nodejs
npm install remove-tabs --save
//app.js
const r = require('remove-tabs');
...
browser
<script src="path/to/bower_components/remove-tabs/remove-tabs.js"></script>
<script>
var r = window['removeTabs'];
...
</script>
amd
//main.js
require.config({
...
paths: {
...
'removeTabs': 'path/to/bower_components/remove-tabs/remove-tabs'
}
});
//app.js
define(['removeTabs'], function(r) {
...
});
Compability
- Compability depends on whether supports "template string" or not
- IE edge(12+), nodejs(4+), firefox(34+), chrome(41+), Safari(9+), iOS(9+)
Usage
Added tabs are annoying when multi-line template strings.
var a = `These
are annoying!!!`;
console.log(a); // 'These\n\t\tare annoying!!!'
So I use tagged function to remove them. It checks first line's tab number and removes other lines's tabs according to it.
var a =
r` Not
annoyed any more :)`;
console.log(a); // 'Not\nannoyed any more :)'
If you don't like leading tagged, top-tagged is also allowed.
var a = r`
Not
annoyed any more too! :)`;
console.log(a); // 'Not\nannoyed any more too! :)'