MCPcopy Create free account
hub / github.com/prettier/prettier / getValueRootOffset

Function getValueRootOffset

src/language-css/loc.js:169–185  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

167}
168
169function getValueRootOffset(node) {
170 let result = node.source.startOffset;
171 if (typeof node.prop === "string") {
172 result += node.prop.length;
173 }
174
175 if (node.type === "css-atrule" && typeof node.name === "string") {
176 result +=
177 1 + node.name.length + node.raws.afterName.match(/^\s*:?\s*/)[0].length;
178 }
179
180 if (node.type !== "css-atrule" && typeof node.raws?.between === "string") {
181 result += node.raws.between.length;
182 }
183
184 return result;
185}
186
187function getAtRuleParamsRootOffset(node) {
188 let result = node.source.startOffset;

Callers 2

getNestedLocFunction · 0.85
getSelectorRootOffsetFunction · 0.85

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected