Skip to content

Commit 7801277

Browse files
stdlib-botkgryte
andauthored
feat: update namespace TypeScript declarations
PR-URL: #1198 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]>
1 parent 848730f commit 7801277

File tree

1 file changed

+63
-0
lines changed
  • lib/node_modules/@stdlib/array/base/docs/types

1 file changed

+63
-0
lines changed

lib/node_modules/@stdlib/array/base/docs/types/index.d.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ import flipud2d = require( '@stdlib/array/base/flipud2d' );
7979
import strided2array = require( '@stdlib/array/base/from-strided' );
8080
import getter = require( '@stdlib/array/base/getter' );
8181
import incrspace = require( '@stdlib/array/base/incrspace' );
82+
import indexOf = require( '@stdlib/array/base/index-of' );
8283
import last = require( '@stdlib/array/base/last' );
84+
import lastIndexOf = require( '@stdlib/array/base/last-index-of' );
8385
import linspace = require( '@stdlib/array/base/linspace' );
8486
import logspace = require( '@stdlib/array/base/logspace' );
8587
import map2d = require( '@stdlib/array/base/map2d' );
@@ -1612,6 +1614,36 @@ interface Namespace {
16121614
*/
16131615
incrspace: typeof incrspace;
16141616

1617+
/**
1618+
* Returns the index of the first element which equals a provided search element.
1619+
*
1620+
* ## Notes
1621+
*
1622+
* - If unable to find an element which equals a provided search element, the function returns `-1`.
1623+
* - If `fromIndex` is less than zero, the starting index is resolved relative to the last array element, with the last array element corresponding to `fromIndex = -1`.
1624+
*
1625+
* @param x - input array
1626+
* @param searchElement - search element
1627+
* @param fromIndex - starting index (inclusive)
1628+
* @param equalNaNs - boolean indicating whether NaNs should be considered equal
1629+
* @returns index
1630+
*
1631+
* @example
1632+
* var x = [ 1, 2, 3, 4 ];
1633+
*
1634+
* var idx = ns.indexOf( x, 2, 0, false );
1635+
* // returns 1
1636+
*
1637+
* @example
1638+
* var Int32Array = require( '@stdlib/array/int32' );
1639+
*
1640+
* var x = new Int32Array( [ 1, 2, 3, 4 ] );
1641+
*
1642+
* var idx = ns.indexOf( x, 2, 0, false );
1643+
* // returns 1
1644+
*/
1645+
indexOf: typeof indexOf;
1646+
16151647
/**
16161648
* Returns the last element of an array-like object.
16171649
*
@@ -1626,6 +1658,37 @@ interface Namespace {
16261658
*/
16271659
last: typeof last;
16281660

1661+
/**
1662+
* Returns the index of the last element which equals a provided search element.
1663+
*
1664+
* ## Notes
1665+
*
1666+
* - The function scans an input array from the starting index to the beginning of the array (i.e., backward).
1667+
* - If unable to find an element which equals a provided search element, the function returns `-1`.
1668+
* - If `fromIndex` is less than zero, the starting index is resolved relative to the last array element, with the last array element corresponding to `fromIndex = -1`.
1669+
*
1670+
* @param x - input array
1671+
* @param searchElement - search element
1672+
* @param fromIndex - starting index (inclusive)
1673+
* @param equalNaNs - boolean indicating whether NaNs should be considered equal
1674+
* @returns index
1675+
*
1676+
* @example
1677+
* var x = [ 1, 2, 3, 4 ];
1678+
*
1679+
* var idx = ns.lastIndexOf( x, 2, 3, false );
1680+
* // returns 1
1681+
*
1682+
* @example
1683+
* var Int32Array = require( '@stdlib/array/int32' );
1684+
*
1685+
* var x = new Int32Array( [ 1, 2, 3, 4 ] );
1686+
*
1687+
* var idx = ns.lastIndexOf( x, 2, 3, false );
1688+
* // returns 1
1689+
*/
1690+
lastIndexOf: typeof lastIndexOf;
1691+
16291692
/**
16301693
* Generates a linearly spaced numeric array.
16311694
*

0 commit comments

Comments
 (0)