npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tiny-jsonl

v3.0.4

Published

Stringify Objects and Arrays into JSONL Strings, and parse JSONL Strings into Objects and Arrays.

Downloads

349

Readme

Tiny JSONL

Stringify Objects and Arrays into JSONL Strings, and parse JSONL Strings into Objects and Arrays.

API

parse()

Converts a JSONL string to an Object or Array of Objects

param  {String} to parse into an Object, or Array of Objects
return {String} JSONL string

Example

import {parse} from "tiny-jsonl";

const arrayObjects = parse('{...}\n{...}\n{...}');

stringify()

Converts an Object or Array of Objects to JSONL string

param  {Array} or {Object} to transform
return {String} JSONL string

Example

import {stringify} from "tiny-jsonl";

const jsonlString = stringify([
    {
        ...
    },
    {
        ...
    }
]);

Testing

Tiny JSONL has 100% code coverage with its tests.

----------------|---------|----------|---------|---------|-------------------
File            | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------------|---------|----------|---------|---------|-------------------
All files       |     100 |      100 |     100 |     100 |                  
 tiny-jsonl.cjs |     100 |      100 |     100 |     100 |                  
----------------|---------|----------|---------|---------|-------------------

Example

Input

import {stringify} from "tiny-jsonl";
stringify([
	{
		"_id": "66897c0b5bb3f3bda598a7be",
		"index": 0,
		"guid": "57cc37b7-ea7b-4cf5-b07e-238a15cc1cdd",
		"isActive": true,
		"balance": "$1,290.80",
		"picture": "http://placehold.it/32x32",
		"age": 21,
		"eyeColor": "blue",
		"name": "Valeria Jenkins",
		"gender": "female",
		"company": "GEOLOGIX",
		"email": "[email protected]",
		"phone": "+1 (976) 597-3338",
		"address": "681 Jackson Place, Collins, Nevada, 8477",
		"about": "Officia sunt fugiat aute eiusmod cillum excepteur enim consectetur in pariatur consequat cupidatat. Id minim anim sint cupidatat nostrud labore esse proident eiusmod eu. Dolor sit aute adipisicing est proident eiusmod voluptate reprehenderit sunt aliquip non quis. Lorem voluptate laboris aliquip cupidatat.\r\n",
		"registered": "2016-04-05T01:14:10 +04:00",
		"latitude": 8.514373,
		"longitude": -22.578972,
		"tags": [
			"voluptate",
			"esse",
			"amet",
			"mollit",
			"in",
			"consectetur",
			"sunt"
		],
		"friends": [
			{
				"id": 0,
				"name": "Moore Howell"
			},
			{
				"id": 1,
				"name": "Summer Cline"
			},
			{
				"id": 2,
				"name": "Francis Simon"
			}
		],
		"greeting": "Hello, Valeria Jenkins! You have 1 unread messages.",
		"favoriteFruit": "banana"
	},
	{
		"_id": "66897c0b0eea9250887803d6",
		"index": 1,
		"guid": "6eac3134-b442-4289-a498-ef9b5624f196",
		"isActive": false,
		"balance": "$1,302.96",
		"picture": "http://placehold.it/32x32",
		"age": 28,
		"eyeColor": "brown",
		"name": "Amanda Rodgers",
		"gender": "female",
		"company": "GRAINSPOT",
		"email": "[email protected]",
		"phone": "+1 (987) 457-3247",
		"address": "650 Osborn Street, Edenburg, New Jersey, 1377",
		"about": "Eu minim enim aliquip nulla aliquip elit sit nostrud dolore reprehenderit aliquip sit qui Lorem. Enim et excepteur dolor velit minim nulla ullamco nisi. Qui adipisicing id occaecat nisi duis quis sint minim laborum minim id. Do id aliqua deserunt incididunt nulla officia nostrud reprehenderit laborum aliquip qui. Veniam pariatur eu quis reprehenderit velit nostrud deserunt deserunt. Commodo duis esse deserunt laborum tempor dolore anim laborum deserunt ipsum sit tempor consectetur.\r\n",
		"registered": "2023-05-27T09:39:08 +04:00",
		"latitude": 45.890773,
		"longitude": -29.059383,
		"tags": [
			"Lorem",
			"sunt",
			"cillum",
			"ea",
			"in",
			"aute",
			"culpa"
		],
		"friends": [
			{
				"id": 0,
				"name": "Jo Nunez"
			},
			{
				"id": 1,
				"name": "Mcdonald Burns"
			},
			{
				"id": 2,
				"name": "Pacheco Vang"
			}
		],
		"greeting": "Hello, Amanda Rodgers! You have 7 unread messages.",
		"favoriteFruit": "strawberry"
	}
]);

Output

{"_id":"66897c0b5bb3f3bda598a7be","index":0,"guid":"57cc37b7-ea7b-4cf5-b07e-238a15cc1cdd","isActive":true,"balance":"$1,290.80","picture":"http://placehold.it/32x32","age":21,"eyeColor":"blue","name":"Valeria Jenkins","gender":"female","company":"GEOLOGIX","email":"[email protected]","phone":"+1 (976) 597-3338","address":"681 Jackson Place, Collins, Nevada, 8477","about":"Officia sunt fugiat aute eiusmod cillum excepteur enim consectetur in pariatur consequat cupidatat. Id minim anim sint cupidatat nostrud labore esse proident eiusmod eu. Dolor sit aute adipisicing est proident eiusmod voluptate reprehenderit sunt aliquip non quis. Lorem voluptate laboris aliquip cupidatat.\\r\\n","registered":"2016-04-05T01:14:10 +04:00","latitude":8.514373,"longitude":-22.578972,"tags":["voluptate","esse","amet","mollit","in","consectetur","sunt"],"friends":[{"id":0,"name":"Moore Howell"},{"id":1,"name":"Summer Cline"},{"id":2,"name":"Francis Simon"}],"greeting":"Hello, Valeria Jenkins! You have 1 unread messages.","favoriteFruit":"banana"}
{"_id":"66897c0b0eea9250887803d6","index":1,"guid":"6eac3134-b442-4289-a498-ef9b5624f196","isActive":false,"balance":"$1,302.96","picture":"http://placehold.it/32x32","age":28,"eyeColor":"brown","name":"Amanda Rodgers","gender":"female","company":"GRAINSPOT","email":"[email protected]","phone":"+1 (987) 457-3247","address":"650 Osborn Street, Edenburg, New Jersey, 1377","about":"Eu minim enim aliquip nulla aliquip elit sit nostrud dolore reprehenderit aliquip sit qui Lorem. Enim et excepteur dolor velit minim nulla ullamco nisi. Qui adipisicing id occaecat nisi duis quis sint minim laborum minim id. Do id aliqua deserunt incididunt nulla officia nostrud reprehenderit laborum aliquip qui. Veniam pariatur eu quis reprehenderit velit nostrud deserunt deserunt. Commodo duis esse deserunt laborum tempor dolore anim laborum deserunt ipsum sit tempor consectetur.\\r\\n","registered":"2023-05-27T09:39:08 +04:00","latitude":45.890773,"longitude":-29.059383,"tags":["Lorem","sunt","cillum","ea","in","aute","culpa"],"friends":[{"id":0,"name":"Jo Nunez"},{"id":1,"name":"Mcdonald Burns"},{"id":2,"name":"Pacheco Vang"}],"greeting":"Hello, Amanda Rodgers! You have 7 unread messages.","favoriteFruit":"strawberry"}

License

Copyright (c) 2024 Jason Mulligan Licensed under the BSD-3 license.