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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

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

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

3.33 kB

Total Files

4

Last publish

Collaborators

  • writetome51