error-if-array-too-short-to-meet-adjacent-items-request

2.0.0 • Public • Published

errorIfArrayTooShortToMeetAdjacentItemsRequest(
      startingIndex,
      numberRequested,
      arrayLength
): void

Triggers error if arrayLength is too short to have numberRequested adjacent
items beginning at startingIndex.
startingIndex can be negative or positive.

Example

let arr = [1,2,3,4,5,6];
errorIfArrayTooShortToMeetAdjacentItemsRequest(1, 6, arr.length);
// Error: "the array does not have enough items to fulfill your request"

Installation

npm install error-if-array-too-short-to-meet-adjacent-items-request

Loading

import { errorIfArrayTooShortToMeetAdjacentItemsRequest } 
    from 'error-if-array-too-short-to-meet-adjacent-items-request';

License

MIT

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i error-if-array-too-short-to-meet-adjacent-items-request

      Weekly Downloads

      1

      Version

      2.0.0

      License

      MIT

      Unpacked Size

      3.33 kB

      Total Files

      4

      Last publish

      Collaborators

      • writetome51