MCPcopy Create free account
hub / github.com/babel/babel / cloneStringLiteral

Function cloneStringLiteral

packages/babel-parser/src/parser/node.ts:208–221  ·  view source on GitHub ↗
(
    node: T,
  )

Source from the content-addressed store, hash-verified

206 }
207
208 cloneStringLiteral<T extends StringLiteral | EstreeLiteral | Placeholder>(
209 node: T,
210 ): T {
211 const { type, start, end, loc, range, extra } = node;
212 const cloned = Object.create(NodePrototype);
213 cloned.type = type;
214 cloned.start = start;
215 cloned.end = end;
216 cloned.loc = loc;
217 cloned.range = range;
218 cloned.extra = extra;
219 cloned.value = (node as StringLiteral).value;
220 return cloned;
221 }
222}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected