diff --git a/CHANGELOG.md b/CHANGELOG.md index 97385619..c2d67707 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,7 @@ ##### Features +- [`00fd68d`](https://github.com/stdlib-js/stdlib/commit/00fd68ddf80a71b08e5353c63c297fca4daaf873) - update namespace TypeScript declarations [(#2415)](https://github.com/stdlib-js/stdlib/pull/2415) - [`fd71d8a`](https://github.com/stdlib-js/stdlib/commit/fd71d8a39d9dc53b0d941945d26178e2e079edbc) - add `place` to namespace - [`20cd086`](https://github.com/stdlib-js/stdlib/commit/20cd0868236daf523fcd659d027e2277f7e1cb56) - add `mskput` to namespace - [`2827035`](https://github.com/stdlib-js/stdlib/commit/2827035933c44ebb301a44200ff9cd5ad73e9ef0) - add `where` to namespace @@ -2115,6 +2116,7 @@ A total of 13 people contributed to this release. Thank you to the following con
+- [`00fd68d`](https://github.com/stdlib-js/stdlib/commit/00fd68ddf80a71b08e5353c63c297fca4daaf873) - **feat:** update namespace TypeScript declarations [(#2415)](https://github.com/stdlib-js/stdlib/pull/2415) _(by stdlib-bot, Athan Reines)_ - [`0b3db04`](https://github.com/stdlib-js/stdlib/commit/0b3db0401bd16df7aeccb500d8280c280a394762) - **feat:** add `toSorted` method to `array/bool` [(#2413)](https://github.com/stdlib-js/stdlib/pull/2413) _(by Jaysukh Makvana)_ - [`e57ccb2`](https://github.com/stdlib-js/stdlib/commit/e57ccb234687de4087aa12348d266ea448f3f241) - **refactor:** update boolean array indexing implementation and add tests _(by Athan Reines)_ - [`d903fc9`](https://github.com/stdlib-js/stdlib/commit/d903fc907ddaacc144a97edaaed0f05abadc470c) - **fix:** require broadcast compatibility _(by Athan Reines)_ diff --git a/base/docs/types/index.d.ts b/base/docs/types/index.d.ts index d07c9581..18c6e6b2 100644 --- a/base/docs/types/index.d.ts +++ b/base/docs/types/index.d.ts @@ -131,6 +131,7 @@ import minSignedIntegerDataType = require( './../../../base/min-signed-integer-d import minUnsignedIntegerDataType = require( './../../../base/min-unsigned-integer-dtype' ); import mskbinary2d = require( './../../../base/mskbinary2d' ); import mskfilter = require( './../../../base/mskfilter' ); +import mskput = require( './../../../base/mskput' ); import mskreject = require( './../../../base/mskreject' ); import mskunary2d = require( './../../../base/mskunary2d' ); import mskunary3d = require( './../../../base/mskunary3d' ); @@ -145,6 +146,7 @@ import ones3d = require( './../../../base/ones3d' ); import ones4d = require( './../../../base/ones4d' ); import ones5d = require( './../../../base/ones5d' ); import onesnd = require( './../../../base/onesnd' ); +import place = require( './../../../base/place' ); import put = require( './../../../base/put' ); import quaternary2d = require( './../../../base/quaternary2d' ); import quaternary3d = require( './../../../base/quaternary3d' ); @@ -182,6 +184,7 @@ import unary4d = require( './../../../base/unary4d' ); import unary5d = require( './../../../base/unary5d' ); import unarynd = require( './../../../base/unarynd' ); import unitspace = require( './../../../base/unitspace' ); +import where = require( './../../../base/where' ); import arrayWith = require( './../../../base/with' ); import zeroTo = require( './../../../base/zero-to' ); import zeros = require( './../../../base/zeros' ); @@ -2874,6 +2877,38 @@ interface Namespace { */ mskfilter: typeof mskfilter; + /** + * Replaces elements of an array with provided values according to a provided mask array. + * + * @param x - input array + * @param mask - mask array + * @param values - values to set + * @param mode - string specifying behavior when the number of values does not equal the number of falsy values in the mask array + * @returns input array + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * + * var mask = [ 1, 0, 0, 1 ]; + * var values = [ 20, 30 ]; + * + * var out = ns.mskput( x, mask, values, 'strict' ); + * // returns [ 1, 20, 30, 4 ] + * + * var bool = ( out === x ); + * // returns true + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * + * var out = ns.mskput( x, [ 1, 0, 0, 1 ], [ 30 ], 'strict_broadcast' ); + * // returns [ 1, 30, 30, 4 ] + * + * var bool = ( out === x ); + * // returns true + */ + mskput: typeof mskput; + /** * Returns a new array by applying a mask to a provided input array. * @@ -3143,6 +3178,38 @@ interface Namespace { */ onesnd: typeof onesnd; + /** + * Replaces elements of an array with provided values according to a provided mask array. + * + * @param x - input array + * @param mask - mask array + * @param values - values to set + * @param mode - string specifying behavior when the number of values does not equal the number of truthy values in the mask array + * @returns input array + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * + * var mask = [ 0, 1, 1, 0 ]; + * var values = [ 20, 30 ]; + * + * var out = ns.place( x, mask, values, 'strict' ); + * // returns [ 1, 20, 30, 4 ] + * + * var bool = ( out === x ); + * // returns true + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * + * var out = ns.place( x, [ 0, 1, 1, 0 ], [ 30 ], 'strict_broadcast' ); + * // returns [ 1, 30, 30, 4 ] + * + * var bool = ( out === x ); + * // returns true + */ + place: typeof place; + /** * Replaces specified elements of an array with provided values. * @@ -4133,6 +4200,38 @@ interface Namespace { */ unitspace: typeof unitspace; + /** + * Takes elements from either one of two arrays depending on a condition. + * + * @param condition - array containing indicator values + * @param x - first input array + * @param y - second input array + * @returns output array + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * var y = [ 5, 6, 7, 8 ]; + * + * var condition = [ true, false, true, false ]; + * + * var z = ns.where( condition, x, y ); + * // returns [ 1, 6, 3, 8 ] + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * var y = [ 5, 6, 7, 8 ]; + * + * var out = [ 0, 0, 0, 0 ]; + * var condition = [ true, false, true, false ]; + * + * var arr = assign( condition, x, y, out, 1, 0 ); + * // returns [ 1, 6, 3, 8 ] + * + * var bool = ( arr === out ); + * // returns true + */ + where: typeof where; + /** * Returns a new array with the element at the specified index replaced with a provided value. *