devalue

  • Version 5.9.2
  • Published
  • 103 kB
  • No dependencies
  • MIT license

Install

npm i devalue
yarn add devalue
pnpm add devalue

Overview

Gets the job done when JSON.stringify can't

Index

Namespaces

namespace devalue

module 'devalue' {}

    variable defaultParseOperations

    const defaultParseOperations: Readonly<DefaultParseOperations_1>;

      variable defaultStringifyOperations

      const defaultStringifyOperations: Readonly<DefaultStringifyOperations_1>;

        function filterArrayIndices

        filterArrayIndices: (keys: readonly string[]) => string[];
        • Given the own enumerable string keys of an array-like value, in property order, returns the leading run of them that are valid array indices.

          This is the filtering half of the indicesOf stringify operation, exposed so that custom operations — which typically already have the keys in hand, e.g. from a foreign runtime — don't have to reimplement it.

          Does not modify keys.

        function parse

        parse: (
        serialized: string,
        revivers?: Record<string, (value: any) => any>,
        options?: ParseOptions_1
        ) => any;
        • Revive a value serialized with devalue.stringify

        function stringify

        stringify: (
        value: any,
        reducers?: Record<string, (value: any) => any>,
        options?: StringifyOptions_1
        ) => string;
        • Turn a value into a JSON string that can be parsed with devalue.parse

        function stringifyAsync

        stringifyAsync: (
        value: any,
        reducers?: Record<string, (value: any) => any>,
        options?: StringifyOptions_1
        ) => Promise<string>;
        • Turn a value into a JSON string that can be parsed with devalue.parse

        function uneval

        uneval: (
        value: any,
        replacer?: (value: any, uneval: (value: any) => string) => string | void
        ) => string;
        • Turn a value into the JavaScript that creates an equivalent value

        function unflatten

        unflatten: (
        parsed: number | any[],
        revivers?: Record<string, (value: any) => any>,
        options?: ParseOptions_1
        ) => any;
        • Revive a value flattened with devalue.stringify

        class DevalueError

        class DevalueError extends Error {}

          constructor

          constructor(message: string, keys: string[], value?: any, root?: any);
          • Parameter value

            The value that failed to be serialized

            Parameter root

            The root value being serialized

          property path

          path: string;

            property root

            root: any;

              property value

              value: any;

                type DefaultParseOperations

                type DefaultParseOperations = DefaultParseOperations_1;

                  type DefaultStringifyOperations

                  type DefaultStringifyOperations = DefaultStringifyOperations_1;

                    type ParseOperations

                    type ParseOperations = ParseOperations_1;

                      type ParseOptions

                      type ParseOptions = ParseOptions_1;

                        type StringifyOperations

                        type StringifyOperations = StringifyOperations_1;

                          type StringifyOptions

                          type StringifyOptions = StringifyOptions_1;

                            type StringValueTag

                            type StringValueTag = StringValueTag_1;

                              type ViewTag

                              type ViewTag = ViewTag_1;

                                Package Files (1)

                                Dependencies (0)

                                No dependencies.

                                Dev Dependencies (7)

                                Peer Dependencies (0)

                                No peer dependencies.

                                Badge

                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/devalue.

                                • Markdown
                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/devalue)
                                • HTML
                                  <a href="https://www.jsdocs.io/package/devalue"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>