MCPcopy Create free account
hub / github.com/Rich-Harris/magic-string / getIndentString

Method getIndentString

benchmark/data.js:959–972  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

957 return new SourceMap(this.generateDecodedMap(options));
958 }
959 getIndentString() {
960 const indentStringCounts = {};
961 this.sources.forEach((source) => {
962 const indentStr = source.content.indentStr;
963 if (indentStr === null) return;
964 if (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0;
965 indentStringCounts[indentStr] += 1;
966 });
967 return (
968 Object.keys(indentStringCounts).sort((a, b) => {
969 return indentStringCounts[a] - indentStringCounts[b];
970 })[0] || ' '
971 );
972 }
973 indent(indentStr) {
974 if (!arguments.length) {
975 indentStr = this.getIndentString();

Callers 1

indentMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected