@unikue/ts-lang-utils
    Preparing search index...

    Function fixLength

    • Returns a length-fixed array from the given array

      Type Parameters

      • E

      Parameters

      • Optionalarray: null | E[]

        The arrays to inspect

      • Optionallength: number

        The length to fix

      • OptionalfillValue: null | E

        The fill value if the array is shorter than the length

      Returns E[]

      a length-fixed array from the given array

      David Hsing

      fixLength(undefined, -1);    // []
      fixLength(['foo', 'bar'], 1); // ['foo']
      fixLength(['foo', 'bar'], 2); // ['foo', 'bar']
      fixLength(['foo', 'bar'], 3); // ['foo', 'bar', undefined]