Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "object/compact"

Index

Functions

Functions

compact

  • compact<T>(object: T, additionalValuesToRemove?: any[]): Partial<T>
  • Additional values can be removed by passing to an array as the second argument


    Example usage:

    import { compact } from "@thalesrc/js-utils/object";
    
    const a = {
     x: null,
     y: undefined,
     z: 20
    };
    
    compact(a); // {z: 20}
    

    Static usage example:

    import "@thalesrc/js-utils/object/static/compact";
    
    const a = {
     x: null,
     y: undefined,
     z: 20
    };
    
    Object.compact(a); // {z: 20}

    Type parameters

    • T: Record<string | number | symbol, any>

    Parameters

    • object: T

      Object delete empty keys

    • Default value additionalValuesToRemove: any[] = []

      Other values to delete

    Returns Partial<T>

    Compacted object

Generated using TypeDoc