npm.io
1.0.3 • Published 2 years ago

@types/json-string-splitter

Licence
MIT
Version
1.0.3
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
51.4K

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 0337 GMT
  • Dependencies: none

Credits

These definitions were written by Jesse Wright.