tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-04-23 20:12:27 +03:00
parent 9d67033cc6
commit 5503686e9e
2 changed files with 16 additions and 4 deletions

View File

@ -12,11 +12,20 @@ function(require){ var module={} // makes module AMD/node compatible...
/*********************************************************************/
// Helpers...
var TAB_SIZE =
module.TAB_SIZE = 4
// XXX is this the right place for this???
// ...when moving take care that ImageGrid's core.doc uses this...
var normalizeIndent =
module.normalizeIndent =
function(text){
function(text, tab_size){
text = TAB_SIZE > 0 ?
text.replace(/\t/g,
' '.repeat(tab_size === undefined ?
tab_size
: TAB_SIZE))
: text
var lines = text.split(/\n/)
var l = lines
.reduce(function(l, e, i){
@ -30,8 +39,11 @@ function(text){
}, -1)
return lines
.map(function(line, i){
return i == 0 ? line : line.slice(l) })
.join('\n') }
return i == 0 ?
line
: line.slice(l) })
.join('\n')
.trim() }

View File

@ -1,6 +1,6 @@
{
"name": "ig-object",
"version": "2.2.0",
"version": "2.2.1",
"description": "",
"main": "object.js",
"scripts": {