stdlib-js / stdlib

✨ Standard library for JavaScript and Node.js. ✨
https://stdlib.io
Apache License 2.0
4.31k stars 438 forks source link

[RFC]: add `@stdlib/array/base/cunone-by` #2325

Open kgryte opened 3 months ago

kgryte commented 3 months ago

Description

This RFC proposes adding the package @stdlib/array/base/cunone-by, which cumulatively tests whether no array element in a provided array passes a test implemented by a predicate function. The function should return a new generic array. The package should also provide an #assign API for setting output values in a provided output array.

function isPositive( value ) {
    return ( value > 0 );
}

var x = [ 0, 0, 0, 1, 0 ];

var y1 = cunoneBy( x, isPositive );
// returns [ true, true, true, false, false ]

var y2 = [ false, null, false, null, false, null, false, null, false, null ];
var out = cunoneBy.assign( x, y2, 2, 0, isPositive );
// returns [ true, null, true, null, true, null, false, null, false, null ]

var bool = ( out === y2 );
// returns true

where the assign API supports an offset and stride (see, e.g., @stdlib/array/base/take).

Both APIs should support accessor arrays (see, e.g., @stdlib/array/base/take).

Related Issues

No.

Questions

No.

Other

Checklist

Naresh-kumar-Thodupunoori commented 1 month ago

@kgryte May I work on this!!?

kgryte commented 1 month ago

@Naresh-kumar-Thodupunoori Thank you for volunteering to work on this. Please feel free to submit a PR implementing this feature.

Also, as this is your first contribution, please only volunteer to work on one issue at a time. Based on our experience, contributors who attempt to work on multiple issues without first having gone through the review process are highly unlikely to ultimately be successful.