3.0.4 • Published 6 months ago

@types/fast-redact v3.0.4

Weekly downloads
5,633
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/fast-redact

Summary

This package contains type definitions for fast-redact (https://github.com/davidmarkclements/fast-redact#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fast-redact.

index.d.ts

// Type definitions for fast-redact 3.0
// Project: https://github.com/davidmarkclements/fast-redact#readme
// Definitions by: asciidisco <https://github.com/asciidisco>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 3.0

export = F;

/**
 * When called without any options, or with a zero length paths array, fast-redact will return JSON.stringify or the serialize option, if set.
 * @param redactOptions
 * @param redactOptions.paths An array of strings describing the nested location of a key in an object.
 * @param redactOptions.censor This is the value which overwrites redacted properties.
 * @param redactOptions.remove The remove option, when set to true will cause keys to be removed from the serialized output.
 * @param redactOptions.serialize The serialize option may either be a function or a boolean. If a function is supplied, this will be used to serialize the redacted object.
 * @param redactOptions.strict The strict option, when set to true, will cause the redactor function to throw if instead of an object it finds a primitive.
 * @returns Redacted value from input
 */
declare function F(redactOptions?: F.RedactOptions): F.redactFn;

declare namespace F {
    /** Redacts input */
    type redactFn = <T>(input: T) => string | T;

    interface RedactOptions {
        /** An array of strings describing the nested location of a key in an object. */
        paths?: string[] | undefined;

        /** This is the value which overwrites redacted properties. */
        censor?: string | ((v: any) => any) | undefined;

        /** The remove option, when set to true will cause keys to be removed from the serialized output. */
        remove?: boolean | undefined;

        /**
         * The serialize option may either be a function or a boolean. If a function is supplied, this will be used to serialize the redacted object.
         * The default serialize is the function JSON.stringify
         */
        serialize?: boolean | ((v: any) => any) | undefined;

        /** The strict option, when set to true, will cause the redactor function to throw if instead of an object it finds a primitive. */
        strict?: boolean | undefined;
    }
}

Additional Details

  • Last updated: Thu, 08 Jul 2021 12:01:29 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by asciidisco.