From bea9b6d4784b6f2667b3952d01773a298c63d1c5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 17 Mar 2024 14:56:48 +0000 Subject: [PATCH] Auto-generated commit --- base/docs/types/index.d.ts | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/base/docs/types/index.d.ts b/base/docs/types/index.d.ts index 094c6656..41e270e1 100644 --- a/base/docs/types/index.d.ts +++ b/base/docs/types/index.d.ts @@ -64,6 +64,8 @@ import cartesianSquare = require( './../../../base/cartesian-square' ); import copy = require( './../../../base/copy' ); import copyIndexed = require( './../../../base/copy-indexed' ); import countFalsy = require( './../../../base/count-falsy' ); +import countSameValue = require( './../../../base/count-same-value' ); +import countSameValueZero = require( './../../../base/count-same-value-zero' ); import countTruthy = require( './../../../base/count-truthy' ); import dedupe = require( './../../../base/dedupe' ); import every = require( './../../../base/every' ); @@ -1340,6 +1342,47 @@ interface Namespace { */ countFalsy: typeof countFalsy; + /** + * Counts the number of elements in an array that are equal to a specified value. + * + * ## Notes + * + * - The function uses the [SameValue Algorithm][ecma-262-same-value-algorithm], as specified in ECMAScript 5. + * - In contrast to the strict equality operator `===`, `-0` and `+0` are distinguishable and `NaNs` are the same. + * + * [ecma-262-same-value-algorithm]: http://ecma-international.org/ecma-262/5.1/#sec-9.12 + * + * @param x - input array + * @param value - search value + * @returns number of elements that are equal to a specified value + * + * @example + * var x = [ 0, 1, 0, 1, 1 ]; + * + * var out = ns.countSameValue( x, 1 ); + * // returns 3 + */ + countSameValue: typeof countSameValue; + + /** + * Counts the number of elements in an array that are equal to a specified value. + * + * ## Notes + * + * - In contrast to an implementation based on the strict equality operator `===`, the function treats `NaNs` as the same value. + * + * @param x - input array + * @param value - search value + * @returns number of elements that are equal to a specified value + * + * @example + * var x = [ 0, 1, 0, 1, 1 ]; + * + * var out = ns.countSameValueZero( x, 1 ); + * // returns 3 + */ + countSameValueZero: typeof countSameValueZero; + /** * Counts the number of truthy values in an array. *