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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@init-kz/jsonparse-ts

v1.0.5

Published

Library for parsing partial jsons inspired by original jsonparse written on js

Readme

JSON Stream Parser (TypeScript Edition)

This is a fully rewritten TypeScript version of the jsonparse library. Originally created by Tim Caswell in 2012, this version modernizes the approach by following OOP principles and introducing additional functionality.

Unlike the original, this version fully supports browser environments and provides enhanced features for better control over JSON parsing.

Features

  • Streaming JSON parsing: Handles JSON data in chunks.
  • Full browser support: Works both in Node.js and browser environments.
  • Improved API: Additional methods for better parsing control.
  • Event-driven architecture: Supports event emitters for handling tokens and values.
  • Better error handling: Capture parsing errors more efficiently.

Installation

npm install @init-kz/jsonparse-ts

Usage

import { Parser } from '@init-kz/jsonparse-ts';

const parser = new Parser();
parser.write('[{"name": "A');
console.log(parser.getLastIncompleteValue()); // { name: "A" }

parser.write('"}, {"na');
console.log(parser.getLastIncompleteValue()); // { name: "A" }, { }

parser.write('me": "Occaecat aliq');
console.log(parser.getLastIncompleteValue()); // { name: "A" }, { name: "Occaecat aliq" }

parser.write('uip id officia ipsum deserunt ea id labore magna qui elit dolore consectetur dolore.');
console.log(parser.getLastValue()); // Full JSON structure

API

getEmitter(): EventEmitter

Returns the event emitter used internally by the parser.

onToken(callback: (token: number, value: any) => void): void

Registers a callback for when a token is parsed.

onValue(callback: (value: any) => void): void

Registers a callback for when a complete value is parsed.

onError(callback: (err: Error) => void): void

Registers a callback for handling errors.

getLastValue(): any

Retrieves the last fully parsed value.

getLastIncompleteValue(omitEmpty?: boolean): any

Retrieves the last partially parsed value, except numbers.

getCurrentKey(): string | number | undefined

Gets the current key being parsed in an object.

getStack(): { value: any; key?: string | number; mode?: number; }[]

Returns the internal parsing stack.

getOffset(): number

Returns the current byte offset in the stream.

write(chunk: string | Uint8Array): void

Processes a chunk of JSON data.

Contributing

Contributions are welcome! Feel free to submit issues or open pull requests to improve the project.

License

The MIT License

Copyright (c) 2012 Tim Caswell
Copyright (c) 2025 INIT.KZ