• Returns the leftmost length characters of the given string

    Parameters

    • Optionaltext: null | string

      the text to inspect

    • Optionallength: number

      the expected length

    Returns string | undefined | null

    the leftmost length characters of the given string

    left('foobar', 3);    // 'foo'
    left('foobar', 10); // 'foobar'