JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1998975
  • Score
    100M100P100Q33050F
  • License MIT

TypeScript definitions for json-stable-stringify

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/json-stable-stringify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Installation

    npm install --save @types/json-stable-stringify

    Summary

    This package contains type definitions for json-stable-stringify (https://github.com/substack/json-stable-stringify).

    Details

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

    index.d.ts

    /**
     * Deterministic version of JSON.stringify() so you can get a consistent hash from stringified results.
     *
     * @returns Deterministic json result.
     */
    declare function stringify(obj: any, opts?: stringify.Comparator | stringify.Options): string;
    
    declare namespace stringify {
        interface Element {
            key: string;
            value: any;
        }
    
        type Comparator = (a: Element, b: Element, opts?: { get(k: string): any }) => number;
    
        type Replacer = (key: string, value: any) => any;
    
        interface Options {
            /**
             * Custom comparator for key
             */
            cmp?: Comparator;
    
            /**
             * Indent the output for pretty-printing.
             *
             * Supported is either a string or a number of spaces.
             */
            space?: string | number;
    
            /**
             * Option to replace values to simpler values
             */
            replacer?: Replacer;
    
            /**
             * true to allow cycles, by marking the entries as __cycle__.
             */
            cycles?: boolean;
        }
    }
    
    export = stringify;
    

    Additional Details

    • Last updated: Thu, 24 Oct 2024 15:34:35 GMT
    • Dependencies: none

    Credits

    These definitions were written by Matt Frantz.