Skip to content

Commit 7c99cbd

Browse files
committed
Add to namespace and update definition file
1 parent f52f807 commit 7c99cbd

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import numGraphemeClusters = require( '@stdlib/string/num-grapheme-clusters' );
3737
import pad = require( '@stdlib/string/pad' );
3838
import pascalcase = require( '@stdlib/string/pascalcase' );
3939
import percentEncode = require( '@stdlib/string/percent-encode' );
40+
import prevGraphemeClusterBreak = require( '@stdlib/string/prev-grapheme-cluster-break' );
4041
import removeFirst = require( '@stdlib/string/remove-first' );
4142
import removeLast = require( '@stdlib/string/remove-last' );
4243
import removePunctuation = require( '@stdlib/string/remove-punctuation' );
@@ -428,6 +429,24 @@ interface Namespace {
428429
*/
429430
percentEncode: typeof percentEncode;
430431

432+
/**
433+
* Returns the previous extended grapheme cluster break in a string before a specified position.
434+
*
435+
* @param str - input string
436+
* @param fromIndex - position (default: str.length-1)
437+
* @throws first argument must be a string
438+
* @throws second argument must be an integer
439+
* @returns previous grapheme break position
440+
*
441+
* @example
442+
* var out = ns.prevGraphemeClusterBreak( 'अनुच्छेद', 2 );
443+
* // returns 0
444+
*
445+
* out = ns.prevGraphemeClusterBreak( '🌷', 1 );
446+
* // returns -1
447+
*/
448+
prevGraphemeClusterBreak: typeof prevGraphemeClusterBreak;
449+
431450
/**
432451
* Removes the first character of a string.
433452
*
@@ -739,6 +758,7 @@ interface Namespace {
739758
*
740759
* @param str - input string
741760
* @param search - search string
761+
* @param fromIndex - index at which to start the search (default: 0)
742762
* @returns substring
743763
*
744764
* @example
@@ -756,6 +776,14 @@ interface Namespace {
756776
* @example
757777
* var out = ns.substringAfter( 'beep boop', 'xyz' );
758778
* // returns ''
779+
*
780+
* @example
781+
* var out = ns.substringAfter( 'beep boop', 'beep', 5 );
782+
* // returns ''
783+
*
784+
* @example
785+
* var out = ns.substringAfter( 'beep boop beep baz', 'beep', 5 );
786+
* // returns ' baz'
759787
*/
760788
substringAfter: typeof substringAfter;
761789

@@ -764,6 +792,7 @@ interface Namespace {
764792
*
765793
* @param str - input string
766794
* @param search - search value
795+
* @param fromIndex - index of last character to be considered beginning of a match (default: `str.length`)
767796
* @returns substring
768797
*
769798
* @example
@@ -785,6 +814,10 @@ interface Namespace {
785814
* @example
786815
* var out = ns.substringAfterLast( 'Hello World', '' );
787816
* // returns ''
817+
*
818+
* @example
819+
* var out = ns.substringAfterLast( 'beep boop baz', 'p b', 6 );
820+
* // returns 'oop baz'
788821
*/
789822
substringAfterLast: typeof substringAfterLast;
790823

lib/node_modules/@stdlib/string/lib/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.
2323
*/
2424

25+
/*
26+
* The following modules are intentionally not exported: tools
27+
*/
28+
2529
// MODULES //
2630

2731
var setReadOnly = require( '@stdlib/utils/define-read-only-property' );
@@ -180,6 +184,15 @@ setReadOnly( string, 'pascalcase', require( '@stdlib/string/pascalcase' ) );
180184
*/
181185
setReadOnly( string, 'percentEncode', require( '@stdlib/string/percent-encode' ) );
182186

187+
/**
188+
* @name prevGraphemeClusterBreak
189+
* @memberof string
190+
* @readonly
191+
* @type {Function}
192+
* @see {@link module:@stdlib/string/prev-grapheme-cluster-break}
193+
*/
194+
setReadOnly( string, 'prevGraphemeClusterBreak', require( '@stdlib/string/prev-grapheme-cluster-break' ) );
195+
183196
/**
184197
* @name removeFirst
185198
* @memberof string

0 commit comments

Comments
 (0)