MCPcopy Index your code
hub / github.com/pomber/code-surfer / wrapToken

Function wrapToken

packs/step-parser/src/tokenizer.ts:66–85  ·  view source on GitHub ↗
(
  prismToken: string | Prism.Token,
  parentType = "plain"
)

Source from the content-addressed store, hash-verified

64}
65
66function wrapToken(
67 prismToken: string | Prism.Token,
68 parentType = "plain"
69): NestedToken {
70 if (typeof prismToken === "string") {
71 return {
72 type: parentType,
73 content: prismToken
74 };
75 }
76
77 if (Array.isArray(prismToken.content)) {
78 return {
79 type: prismToken.type,
80 content: tokenizeStrings(prismToken.content, prismToken.type)
81 };
82 }
83
84 return wrapToken(prismToken.content, prismToken.type);
85}
86
87type FlatToken = {
88 type: string;

Callers 1

tokenizeStringsFunction · 0.85

Calls 1

tokenizeStringsFunction · 0.85

Tested by

no test coverage detected