Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "limit"

Index

Functions

Functions

limit

  • limit<T>(array: T[], count: number): T[]
  • limit(str: string, count: number): string
  • Limits the string or array to n character


    Example usage:

    import { limit } from "@thalesrc/js-utils";
    
    const str = 'foobarbaz';
    const array = ["a", "b", "c", "d", "e", "f"];
    
    limit(str, 3); // 'foo'
    limit(array, 3); // ["a", "b", "c"]

    Type parameters

    • T

    Parameters

    • array: T[]
    • count: number

      Max count

    Returns T[]

  • Limits the string or array to n character


    Example usage:

    import { limit } from "@thalesrc/js-utils";
    
    const str = 'foobarbaz';
    const array = ["a", "b", "c", "d", "e", "f"];
    
    limit(str, 3); // 'foo'
    limit(array, 3); // ["a", "b", "c"]

    Parameters

    • str: string
    • count: number

      Max count

    Returns string

Generated using TypeDoc