npm.io
1.0.2 • Published 2 years ago

@types/negative-index

Licence
MIT
Version
1.0.2
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/negative-index

Summary

This package contains type definitions for negative-index (https://github.com/dy/negative-index#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/negative-index.

index.d.ts

export = negativeIndex;

/**
 * Convert negative index to positive starting from the end. Same way
 * [Array.slice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice)
 * arguments work.
 *
 * @example
 * import idx = require('negative-index');
 *
 * idx(-5, 8); // 3
 * idx(5, 8); // 5
 *
 * @example
 * // Works well for normalizing real numbers offset, like time etc:
 *
 * import normOffset = require('negative-index');
 *
 * const time = -.15, duration = 2.45;
 *
 * normOffset(time, duration); // 2.3
 */
declare function negativeIndex(index: number, length: number): number;

Additional Details

  • Last updated: Tue, 07 Nov 2023 0939 GMT
  • Dependencies: none

Credits

These definitions were written by BendingBender.