Skip to content

Commit 1c7893a

Browse files
committed
Auto-generated commit
1 parent fd335ea commit 1c7893a

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

docs/types/index.d.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ import cartesianSquare = require( '@stdlib/array-base-cartesian-square' );
6464
import copy = require( '@stdlib/array-base-copy' );
6565
import copyIndexed = require( '@stdlib/array-base-copy-indexed' );
6666
import countFalsy = require( '@stdlib/array-base-count-falsy' );
67+
import countSameValue = require( '@stdlib/array-base-count-same-value' );
68+
import countSameValueZero = require( '@stdlib/array-base-count-same-value-zero' );
6769
import countTruthy = require( '@stdlib/array-base-count-truthy' );
6870
import dedupe = require( '@stdlib/array-base-dedupe' );
6971
import every = require( '@stdlib/array-base-every' );
@@ -1340,6 +1342,47 @@ interface Namespace {
13401342
*/
13411343
countFalsy: typeof countFalsy;
13421344

1345+
/**
1346+
* Counts the number of elements in an array that are equal to a specified value.
1347+
*
1348+
* ## Notes
1349+
*
1350+
* - The function uses the [SameValue Algorithm][ecma-262-same-value-algorithm], as specified in ECMAScript 5.
1351+
* - In contrast to the strict equality operator `===`, `-0` and `+0` are distinguishable and `NaNs` are the same.
1352+
*
1353+
* [ecma-262-same-value-algorithm]: http://ecma-international.org/ecma-262/5.1/#sec-9.12
1354+
*
1355+
* @param x - input array
1356+
* @param value - search value
1357+
* @returns number of elements that are equal to a specified value
1358+
*
1359+
* @example
1360+
* var x = [ 0, 1, 0, 1, 1 ];
1361+
*
1362+
* var out = ns.countSameValue( x, 1 );
1363+
* // returns 3
1364+
*/
1365+
countSameValue: typeof countSameValue;
1366+
1367+
/**
1368+
* Counts the number of elements in an array that are equal to a specified value.
1369+
*
1370+
* ## Notes
1371+
*
1372+
* - In contrast to an implementation based on the strict equality operator `===`, the function treats `NaNs` as the same value.
1373+
*
1374+
* @param x - input array
1375+
* @param value - search value
1376+
* @returns number of elements that are equal to a specified value
1377+
*
1378+
* @example
1379+
* var x = [ 0, 1, 0, 1, 1 ];
1380+
*
1381+
* var out = ns.countSameValueZero( x, 1 );
1382+
* // returns 3
1383+
*/
1384+
countSameValueZero: typeof countSameValueZero;
1385+
13431386
/**
13441387
* Counts the number of truthy values in an array.
13451388
*

0 commit comments

Comments
 (0)