( type: string, attrs: Record<string, string | number>, children?: string )
| 241 | } |
| 242 | |
| 243 | export function buildXMLString( |
| 244 | type: string, |
| 245 | attrs: Record<string, string | number>, |
| 246 | children?: string |
| 247 | ) { |
| 248 | let attrString = '' |
| 249 | |
| 250 | for (const [k, _v] of Object.entries(attrs)) { |
| 251 | if (typeof _v !== 'undefined') { |
| 252 | attrString += ` ${k}="${_v}"` |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | if (children) { |
| 257 | return `<${type}${attrString}>${children}</${type}>` |
| 258 | } |
| 259 | return `<${type}${attrString}/>` |
| 260 | } |
| 261 | |
| 262 | export function createLRU<T>(max = 20) { |
| 263 | const store: Map<string, T> = new Map() |
no outgoing calls
no test coverage detected
searching dependent graphs…