MCPcopy Create free account
hub / github.com/Effect-TS/effect / compact

Method compact

packages/effect/src/encoding/Xml.ts:1953–1968  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1951 // the released ones outweigh the open ones, so rebuilds are linear in the
1952 // input.
1953 private compact(): void {
1954 const bindings = new Map<string, Namespace | undefined>()
1955 const namespacesByName = new Map<string, Namespace>()
1956 for (const [prefix, namespace] of this.bindings) {
1957 if (namespace === undefined) continue
1958 bindings.set(prefix, namespace)
1959 namespacesByName.set(namespace.uri, namespace)
1960 }
1961 // A shadowed binding comes back into scope when its element closes
1962 for (const namespace of this.undoBindings) {
1963 if (namespace !== undefined) namespacesByName.set(namespace.uri, namespace)
1964 }
1965 this.bindings = bindings
1966 this.namespacesByName = namespacesByName
1967 this.releasedDeclarationSize = 0
1968 }
1969
1970 // A DTD can declare a prefix with a default attribute value, which is not
1971 // applied, so an undeclared prefix is a `Syntax` error only without a DOCTYPE

Callers 9

restoreMethod · 0.95
Chunk.test.tsFile · 0.80
HashMap.test.tsFile · 0.80
TxHashMap.test.tsFile · 0.80
Trie.test.tsFile · 0.80
compactFunction · 0.80
makeFunction · 0.80
EventJournal.tsFile · 0.80
makeIndexedDbFunction · 0.80

Calls 1

setMethod · 0.65

Tested by

no test coverage detected