Comparing version 0.0.3 to 0.0.4
@@ -37,11 +37,22 @@ /** | ||
function indentedLine(line) { | ||
const indent = getFirstCharacterPosition(line); | ||
return new Line(indent, line.substr(indent)); | ||
const [position, indent] = getFirstCharacterPosition(line); | ||
return new Line(indent, line.substr(position)); | ||
} | ||
function getFirstCharacterPosition(line) { | ||
let indent = 0; | ||
while (line.charAt(indent) === " ") { | ||
indent++; | ||
let i = 0; | ||
let c; | ||
while ((c = line.charAt(i))) { | ||
if (c === " ") { | ||
indent += 1; | ||
} | ||
else if (c === "\t") { | ||
indent += 2; | ||
} | ||
else { | ||
break; | ||
} | ||
i++; | ||
} | ||
return indent; | ||
return [i, indent]; | ||
} |
@@ -8,3 +8,3 @@ import { Line, lines } from "./lines"; | ||
c | ||
d | ||
\t\t\t\td | ||
e | ||
@@ -11,0 +11,0 @@ f |
{ | ||
"name": "ferns", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"author": "Francois Wouts", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
153471
1110
0