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... // Helpers...
var TAB_SIZE =
module.TAB_SIZE = 4
// XXX is this the right place for this??? // XXX is this the right place for this???
// ...when moving take care that ImageGrid's core.doc uses this... // ...when moving take care that ImageGrid's core.doc uses this...
var normalizeIndent = var normalizeIndent =
module.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 lines = text.split(/\n/)
var l = lines var l = lines
.reduce(function(l, e, i){ .reduce(function(l, e, i){
@ -30,8 +39,11 @@ function(text){
}, -1) }, -1)
return lines return lines
.map(function(line, i){ .map(function(line, i){
return i == 0 ? line : line.slice(l) }) return i == 0 ?
.join('\n') } line
: line.slice(l) })
.join('\n')
.trim() }

View File

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