MCPcopy Index your code
hub / github.com/SplootCode/splootcode / serialize

Method serialize

packages/core/src/language/node.ts:327–351  ·  view source on GitHub ↗
(includeMatchingID = false)

Source from the content-addressed store, hash-verified

325 }
326
327 serialize(includeMatchingID = false): SerializedNode {
328 const result = {
329 type: this.type,
330 properties: {},
331 childSets: {},
332 } as SerializedNode
333 if (includeMatchingID) {
334 result.matchingID = this.matchingID
335 }
336 for (const property in this.properties) {
337 result.properties[property] = this.properties[property]
338 }
339 if (this.metadata.size !== 0) {
340 result.meta = Object.fromEntries(this.metadata)
341 }
342
343 this.childSetOrder.forEach((childSetId: string) => {
344 const childSet = this.getChildSet(childSetId)
345 result.childSets[childSetId] = []
346 childSet.getChildren().forEach((node: SplootNode) => {
347 result.childSets[childSetId].push(node.serialize(includeMatchingID))
348 })
349 })
350 return result
351 }
352
353 applySerializedSnapshot(snapshot: SerializedNode) {
354 // Recursively apply the serialized snapshot to this node and children

Callers 13

cloneMethod · 0.95
savePackageFunction · 0.45
exportProjectToFolderFunction · 0.45
cloneProjectMethod · 0.45
saveProjectMethod · 0.45
saveFileMethod · 0.45
EditorClass · 0.45
ScopeTreeFunction · 0.45
onDragStartFunction · 0.45
UndoWatcherClass · 0.45
getAllFileStateMethod · 0.45

Calls 2

getChildSetMethod · 0.95
getChildrenMethod · 0.80

Tested by

no test coverage detected