3 module.exports = indentation;
5 /* Map of characters, and their column length,
6 * which can be used as indentation. */
7 var characters = {' ': 1, '\t': 4};
9 /* Gets indentation information for a line. */
10 function indentation(value) {
13 var character = value.charAt(index);
17 while (character in characters) {
18 size = characters[character];
23 indent = Math.floor(indent / size) * size;
26 stops[indent] = index;
28 character = value.charAt(++index);
31 return {indent: indent, stops: stops};