MCPcopy Create free account
hub / github.com/JavaCS3/xterm-player / parse

Method parse

src/CastParser.ts:38–61  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

36 */
37export class AsciinemaCastV1Parser implements ICastParser {
38 public parse(text: string): ICastObject {
39 const j = JSON.parse(text)
40 const stdouts: Array<[number, string]> = j.stdout
41
42 let timestamp = 0.0
43 const events = stdouts.map(e => {
44 timestamp += e[0] * MILLISECOND
45 return {
46 time: timestamp,
47 type: 'o',
48 data: e[1]
49 }
50 })
51
52 return {
53 header: {
54 version: 1,
55 width: j.width,
56 height: j.height,
57 duration: j.duration * MILLISECOND
58 },
59 events
60 }
61 }
62}
63
64/**

Callers

nothing calls this directly

Calls 1

parseMethod · 0.65

Tested by

no test coverage detected