### Install js-jsonl using npm Source: https://github.com/leonsilicon/js-jsonl/blob/main/readme.md Installs the js-jsonl package from npm. This is the first step to using the library in your project. ```shell npm install js-jsonl ``` -------------------------------- ### Parse and Stringify JSONL Data in TypeScript Source: https://github.com/leonsilicon/js-jsonl/blob/main/readme.md Demonstrates how to parse a JSONL string into a JavaScript array and stringify a JavaScript array back into a JSONL string using the js-jsonl library. It also shows type safety with TypeScript generics. ```typescript import { jsonl } from 'js-jsonl'; const jsonlString = ` ["Name", "Session", "Score", "Completed"] ["Gilbert", "2013", 24, true] ["Alexa", "2013", 29, true] ["May", "2012B", 14, false] ["Deloise", "2012A", 19, true] `; const jsonlParsed = [ ["Name", "Session", "Score", "Completed"], ["Gilbert", "2013", 24, true], ["Alexa", "2013", 29, true], ["May", "2012B", 14, false], ["Deloise", "2012A", 19, true] ]; expect(jsonl.parse(jsonlString)).toEqual(jsonlParsed); expect(jsonl.stringify(jsonlParsed)).toEqual(jsonlString); // Also works with TypeScript! const fooBar = jsonl.parse<{ foo: 'bar' }>("{foo: 'bar'}"); const fooBarString = jsonl.stringify(fooBar) const fooBarParsed: { foo: 'bar' } = jsonl.parse(fooBarString); // no type error! ``` -------------------------------- ### Infer JSONL Type with JsonlInfer in TypeScript Source: https://github.com/leonsilicon/js-jsonl/blob/main/readme.md Illustrates how to use the `JsonlInfer` helper from the js-jsonl library to infer the TypeScript type of parsed JSONL data. This enhances type safety when working with structured JSONL content. ```typescript import { jsonl } from 'js-jsonl'; import type { JsonlInfer } from 'js-jsonl'; const fooBar = jsonl.parse<{ foo: string }>("{foo: 'bar'}\n{foo: 'baz'}"); type FooBarParsed = JsonlInfer // { foo: string } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.