@types/json-string-splitter
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Installation

npm install --save @types/json-string-splitter

Summary

This package contains type definitions for json-string-splitter (https://github.com/Densaugeo/JSON-String-Splitter).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-string-splitter.

index.d.ts

export = splitter;

/**
 * Accepts a string consisting of one or more valid JSON substrings and splits it. Any remaining string after the end of the last complete JSON substring is returned in the 'remainder' field.
 *
 * Passing in invalid JSON can result in garbage output
 *
 * @alias splitter
 * @since 1.0.0
 * @param string The string to look for JSON in
 *
 * @example
 * import splitter = require("json-string-splitter");
 *
 * const pieces = splitter('{"foo":"bar"}{"more":"json"}{"partial":"json"');
 *
 * pieces.jsons[0]; // '{"foo":"bar"}'
 * pieces.jsons[1]; // '{"more":"json"}'
 * pieces.remainder; // '{"partial":"json"'
 */
declare function splitter(string: string): { jsons: string[]; remainder: string };

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: none

Credits

These definitions were written by Jesse Wright.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/json-string-splitter

Weekly Downloads

15

Version

1.0.3

License

MIT

Unpacked Size

4.07 kB

Total Files

5

Last publish

Collaborators

  • types