* Returns a string representation. * @returns {string} stringified lockfile
()
| 274 | * @returns {string} stringified lockfile |
| 275 | */ |
| 276 | toString() { |
| 277 | let str = "{\n"; |
| 278 | const entries = [...this.entries].sort(([a], [b]) => (a < b ? -1 : 1)); |
| 279 | for (const [key, entry] of entries) { |
| 280 | if (typeof entry === "string") { |
| 281 | str += ` ${JSON.stringify(key)}: ${JSON.stringify(entry)},\n`; |
| 282 | } else { |
| 283 | str += ` ${JSON.stringify(key)}: { `; |
| 284 | if (entry.resolved !== key) { |
| 285 | str += `"resolved": ${JSON.stringify(entry.resolved)}, `; |
| 286 | } |
| 287 | str += `"integrity": ${JSON.stringify( |
| 288 | entry.integrity |
| 289 | )}, "contentType": ${JSON.stringify(entry.contentType)} },\n`; |
| 290 | } |
| 291 | } |
| 292 | str += ` "version": ${this.version}\n}\n`; |
| 293 | return str; |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | /** |
no test coverage detected