Skip to content

Commit 02c9e03

Browse files
stdlib-botkgryte
andauthored
feat: update namespace TypeScript declarations
PR-URL: #2136 Co-authored-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Athan Reines <kgryte@gmail.com> Signed-off-by: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com>
1 parent f684340 commit 02c9e03

File tree

2 files changed

+129
-0
lines changed

2 files changed

+129
-0
lines changed

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

+23
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ import unary4d = require( '@stdlib/array/base/unary4d' );
177177
import unary5d = require( '@stdlib/array/base/unary5d' );
178178
import unarynd = require( '@stdlib/array/base/unarynd' );
179179
import unitspace = require( '@stdlib/array/base/unitspace' );
180+
import arrayWith = require( '@stdlib/array/base/with' );
180181
import zeroTo = require( '@stdlib/array/base/zero-to' );
181182
import zeros = require( '@stdlib/array/base/zeros' );
182183
import zeros2d = require( '@stdlib/array/base/zeros2d' );
@@ -3996,6 +3997,28 @@ interface Namespace {
39963997
*/
39973998
unitspace: typeof unitspace;
39983999

4000+
/**
4001+
* Returns a new array with the element at the specified index replaced with a provided value.
4002+
*
4003+
* @param x - input array
4004+
* @param index - index at which to set a provided value
4005+
* @param value - replacement value
4006+
* @returns output array
4007+
*
4008+
* @example
4009+
* var x = [ 1, 2, 3 ];
4010+
*
4011+
* var out = ns.arrayWith( x, 0, 7 );
4012+
* // returns [ 7, 2, 3 ]
4013+
*
4014+
* @example
4015+
* var x = [ 1, 2, 3, 4, 5, 6 ];
4016+
*
4017+
* var out = ns.arrayWith( x, 2, 8 );
4018+
* // returns [ 1, 8, 3, 4, 5, 6 ]
4019+
*/
4020+
arrayWith: typeof arrayWith;
4021+
39994022
/**
40004023
* Generates a linearly spaced numeric array whose elements increment by 1 starting from zero.
40014024
*

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

+106
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ import removeLastGraphemeCluster = require( '@stdlib/string/base/remove-last-gra
5454
import repeat = require( '@stdlib/string/base/repeat' );
5555
import replace = require( '@stdlib/string/base/replace' );
5656
import replaceAfter = require( '@stdlib/string/base/replace-after' );
57+
import replaceAfterLast = require( '@stdlib/string/base/replace-after-last' );
5758
import replaceBefore = require( '@stdlib/string/base/replace-before' );
59+
import replaceBeforeLast = require( '@stdlib/string/base/replace-before-last' );
5860
import reverse = require( '@stdlib/string/base/reverse' );
5961
import reverseCodePoints = require( '@stdlib/string/base/reverse-code-points' );
6062
import reverseGraphemeClusters = require( '@stdlib/string/base/reverse-grapheme-clusters' );
@@ -829,6 +831,11 @@ interface Namespace {
829831
/**
830832
* Replaces the substring after the first occurrence of a specified search string.
831833
*
834+
* ## Notes
835+
*
836+
* - If unable to find search string, the function returns the input string unchanged.
837+
* - If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`.
838+
*
832839
* @param str - input string
833840
* @param search - search string
834841
* @param replacement - replacement string
@@ -861,9 +868,61 @@ interface Namespace {
861868
*/
862869
replaceAfter: typeof replaceAfter;
863870

871+
/**
872+
* Replaces the substring after the last occurrence of a specified search string.
873+
*
874+
* ## Notes
875+
*
876+
* - The function scans a provided string from the starting index to the beginning of the string (i.e., backward).
877+
* - If unable to find search string, the function returns the input string unchanged.
878+
* - If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`.
879+
*
880+
* @param str - input string
881+
* @param search - search string
882+
* @param replacement - replacement string
883+
* @param fromIndex - index from which to start searching
884+
* @returns output string
885+
*
886+
* @example
887+
* var str = 'beep boop';
888+
* var out = ns.replaceAfterLast( str, ' ', 'foo', str.length );
889+
* // returns 'beep foo'
890+
*
891+
* @example
892+
* var str = 'beep boop';
893+
* var out = ns.replaceAfterLast( str, 'p', 'foo', str.length );
894+
* // returns 'beep boopfoo'
895+
*
896+
* @example
897+
* var str = 'Hello World!';
898+
* var out = ns.replaceAfterLast( str, '', 'foo', str.length );
899+
* // returns 'Hello World!'
900+
*
901+
* @example
902+
* var str = 'Hello World!';
903+
* var out = ns.replaceAfterLast( str, 'xyz', 'foo', str.length );
904+
* // returns 'Hello World!'
905+
*
906+
* @example
907+
* var str = 'beep boop baz';
908+
* var out = ns.replaceAfterLast( str, 'p b', 'foo', str.length );
909+
* // returns 'beep boop bfoo'
910+
*
911+
* @example
912+
* var str = 'beep boop baz';
913+
* var out = ns.replaceAfterLast( str, 'p b', 'foo', 6 );
914+
* // returns 'beep bfoo'
915+
*/
916+
replaceAfterLast: typeof replaceAfterLast;
917+
864918
/**
865919
* Replaces the substring before the first occurrence of a specified search string.
866920
*
921+
* ## Notes
922+
*
923+
* - If unable to find search string, the function returns the input string unchanged.
924+
* - If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`.
925+
*
867926
* @param str - input string
868927
* @param search - search string
869928
* @param replacement - replacement string
@@ -888,6 +947,53 @@ interface Namespace {
888947
*/
889948
replaceBefore: typeof replaceBefore;
890949

950+
/**
951+
* Replaces the substring before the last occurrence of a specified search string.
952+
*
953+
* ## Notes
954+
*
955+
* - The function scans a provided string from the starting index to the beginning of the string (i.e., backward).
956+
* - If unable to find search string, the function returns the input string unchanged.
957+
* - If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`.
958+
*
959+
* @param str - input string
960+
* @param search - search string
961+
* @param replacement - replacement string
962+
* @param fromIndex - index from which to start searching
963+
* @returns output string
964+
*
965+
* @example
966+
* var str = 'beep boop';
967+
* var out = ns.replaceBeforeLast( str, ' ', 'foo', str.length );
968+
* // returns 'foo boop'
969+
*
970+
* @example
971+
* var str = 'beep boop';
972+
* var out = ns.replaceBeforeLast( str, 'p', 'foo', str.length );
973+
* // returns 'foop'
974+
*
975+
* @example
976+
* var str = 'Hello World!';
977+
* var out = ns.replaceBeforeLast( str, '', 'foo', str.length );
978+
* // returns 'Hello World!'
979+
*
980+
* @example
981+
* var str = 'Hello World!';
982+
* var out = ns.replaceBeforeLast( str, 'xyz', 'foo', str.length );
983+
* // returns 'Hello World!'
984+
*
985+
* @example
986+
* var str = 'beep boop baz';
987+
* var out = ns.replaceBeforeLast( str, 'p b', 'foo', str.length );
988+
* // returns 'foop baz'
989+
*
990+
* @example
991+
* var str = 'beep boop baz';
992+
* var out = ns.replaceBeforeLast( str, 'p b', 'foo', 6 );
993+
* // returns 'foop boop baz'
994+
*/
995+
replaceBeforeLast: typeof replaceBeforeLast;
996+
891997
/**
892998
* Reverses the UTF-16 code units of a string.
893999
*

0 commit comments

Comments
 (0)