node-json-db
    Preparing search index...

    Serializer for JavaScript RegExp objects. Serializes a RegExp as an object with source and flags.

    { "__type": "RegExp", "__value": { "source": "hello\\s+world", "flags": "gi" } }
    

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    type: "RegExp"

    Unique type identifier stored as __type in the serialized JSON.

    Methods

    • Deserialize a value from its JSON representation. The input is the __value from the serialized JSON.

      Parameters

      • value: { flags: string; source: string }

        The stored JSON value

      Returns RegExp

      The deserialized runtime value

    • Serialize a value to a JSON-compatible representation. The returned value will be stored under __value in the serialized JSON.

      Parameters

      • value: RegExp

        The value to serialize

      Returns { flags: string; source: string }

      A JSON-compatible value

    • Test if a runtime value should be handled by this serializer.

      Parameters

      • value: any

        The value to test

      Returns boolean

      true if this serializer should handle this value