| 177 | |
| 178 | // Format for display |
| 179 | formatList() { |
| 180 | const objects = this.all(); |
| 181 | if (objects.length === 0) return ' (no memory objects)'; |
| 182 | |
| 183 | const byType = {}; |
| 184 | for (const obj of objects) { |
| 185 | if (!byType[obj.type]) byType[obj.type] = []; |
| 186 | byType[obj.type].push(obj); |
| 187 | } |
| 188 | |
| 189 | let output = ''; |
| 190 | for (const [type, objs] of Object.entries(byType)) { |
| 191 | output += ` ${type} (${objs.length}):\n`; |
| 192 | for (const obj of objs) { |
| 193 | output += ` [${obj.id}] ${obj.title}\n`; |
| 194 | } |
| 195 | } |
| 196 | return output; |
| 197 | } |
| 198 | |
| 199 | // Get stats |
| 200 | stats() { |