mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
minor update...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b36716c1ad
commit
cfb52584da
@ -237,25 +237,22 @@ function(strings, ...values){
|
|||||||
.split(/\n/g)
|
.split(/\n/g)
|
||||||
|
|
||||||
// get the common whitespae offset...
|
// get the common whitespae offset...
|
||||||
var l = -1
|
var l = lines
|
||||||
lines.forEach(function(line, i){
|
.reduce(function(l, e, i){
|
||||||
if(line.trim().length == 0){
|
var indent = e.length - e.trimLeft().length
|
||||||
return
|
return (
|
||||||
}
|
// ignore empty lines...
|
||||||
|
e.trim().length == 0
|
||||||
// get the indent...
|
// ignore 0 indent of first line...
|
||||||
var a = line.length - line.trimLeft().length
|
|| (i == 0 && indent == 0) ? l
|
||||||
|
: l < 0 ?
|
||||||
// if line 0 is not indented, ignore it...
|
indent
|
||||||
if(i == 0 && a == 0){
|
: Math.min(l, indent))
|
||||||
return
|
}, -1)
|
||||||
}
|
|
||||||
|
|
||||||
l = l < 0 ? a : Math.min(l, a)
|
|
||||||
})
|
|
||||||
|
|
||||||
return lines
|
return lines
|
||||||
.map(function(line, i){ return i == 0 ? line : line.slice(l) })
|
.map(function(line, i){
|
||||||
|
return i == 0 ? line : line.slice(l) })
|
||||||
.join('\n')
|
.join('\n')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user