Giter Club home page Giter Club logo

json-split-transformer's Introduction

json-split-transformer

A fast and lightweight transformer to transform chunks of JSON strings to valid JSON strings

GitHub license npm version build Dependabot semantic-release

Usage

import { ArrayIterator } from 'asynciterator'
import JSONSplitTransformer from 'json-split-transformer';

const streamSplitter = new JSONSplitTransformer();

const iterator = new ArrayIterator<string>([
  "{\"time\":1625581",
  "199",
  "479,\"values\":[32,23]}{\"ti",
  "me\":1625581199482,\"values\":[31,12]}"
]);

// New iterator that will emit the objects
// {time: 1625581199479, values: [32, 23]}
// and
// {time: 1625581199482, values: [31, 12]}
const newIterator = iterator
  .map(buffer => buffer.toString())
  // Split up concatenated JSON strings
  .transform<string>({ transform: streamSplitter.transform })
  // Parse each JSON string
  .map(JSON.parse)

License

©2021–present Jesse Wright, MIT License.

json-split-transformer's People

Contributors

dependabot[bot] avatar jeswr avatar

Watchers

 avatar

json-split-transformer's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.