Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 68 additions & 5 deletions lib/node_modules/@stdlib/string/base/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import firstGraphemeCluster = require( '@stdlib/string/base/first-grapheme-clust
import forEach = require( '@stdlib/string/base/for-each' );
import forEachCodePoint = require( '@stdlib/string/base/for-each-code-point' );
import forEachGraphemeCluster = require( '@stdlib/string/base/for-each-grapheme-cluster' );
import forEachRight = require( '@stdlib/string/base/for-each-right' );
import formatInterpolate = require( '@stdlib/string/base/format-interpolate' );
import formatTokenize = require( '@stdlib/string/base/format-tokenize' );
import headercase = require( '@stdlib/string/base/headercase' );
Expand All @@ -52,6 +53,7 @@ import removeLastCodePoint = require( '@stdlib/string/base/remove-last-code-poin
import removeLastGraphemeCluster = require( '@stdlib/string/base/remove-last-grapheme-cluster' );
import repeat = require( '@stdlib/string/base/repeat' );
import replace = require( '@stdlib/string/base/replace' );
import replaceAfter = require( '@stdlib/string/base/replace-after' );
import replaceBefore = require( '@stdlib/string/base/replace-before' );
import reverse = require( '@stdlib/string/base/reverse' );
import reverseCodePoints = require( '@stdlib/string/base/reverse-code-points' );
Expand Down Expand Up @@ -384,6 +386,31 @@ interface Namespace {
*/
forEachGraphemeCluster: typeof forEachGraphemeCluster;

/**
* Invokes a function for each UTF-16 code unit in a string, iterating from right to left.
*
* ## Notes
*
* - When invoked, the provided function is provided three arguments:
*
* - **value**: character.
* - **index**: character index.
* - **str**: input string.
*
* @param str - input string
* @param clbk - function to invoke
* @param thisArg - execution context
* @returns input string
*
* @example
* function log( value, index ) {
* console.log( '%d: %s', index, value );
* }
*
* forEach( 'Hello, World!', log );
*/
forEachRight: typeof forEachRight;

/**
* Generates string from a token array by interpolating values.
*
Expand Down Expand Up @@ -799,28 +826,64 @@ interface Namespace {
*/
replace: typeof replace;

/**
* Replaces the substring after the first occurrence of a specified search string.
*
* @param str - input string
* @param search - search string
* @param replacement - replacement string
* @param fromIndex - index at which to start the search
* @returns output string
*
* @example
* var out = ns.replaceAfter( 'beep boop', ' ', 'foo', 0 );
* // returns 'beep foo'
*
* @example
* var out = ns.replaceAfter( 'beep boop', 'p', 'foo', 5 );
* // returns 'beep boopfoo'
*
* @example
* var out = ns.replaceAfter( 'Hello World!', '', 'foo', 0 );
* // returns 'Hello World!'
*
* @example
* var out = ns.replaceAfter( 'Hello World!', 'xyz', 'foo', 0 );
* // returns 'Hello World!'
*
* @example
* var out = ns.replaceAfter( 'beep boop', ' ', 'foo' , 5 );
* // returns 'beep foo'
*
* @example
* var out = ns.replaceAfter( 'beep boop beep baz', 'beep', 'foo' , 5 );
* // returns 'beep boop beepfoo'
*/
replaceAfter: typeof replaceAfter;

/**
* Replaces the substring before the first occurrence of a specified search string.
*
* @param str - input string
* @param search - search string
* @param replacement - replacement string
* @param fromIndex - index at which to start the search
* @returns output string
*
* @example
* var out = ns.replaceBefore( 'beep boop', ' ', 'foo' );
* var out = ns.replaceBefore( 'beep boop', ' ', 'foo', 0 );
* // returns 'foo boop'
*
* @example
* var out = ns.replaceBefore( 'beep boop', 'p', 'foo' );
* // returns 'foop boop'
* var out = ns.replaceBefore( 'beep boop', 'p', 'foo', 5 );
* // returns 'foop'
*
* @example
* var out = ns.replaceBefore( 'Hello World!', '', 'foo' );
* var out = ns.replaceBefore( 'Hello World!', '', 'foo', 0 );
* // returns 'Hello world!'
*
* @example
* var out = ns.replaceBefore( 'Hello World!', 'xyz', 'foo' );
* var out = ns.replaceBefore( 'Hello World!', 'xyz', 'foo', 0 );
* // returns 'Hello World!'
*/
replaceBefore: typeof replaceBefore;
Expand Down