8000 Auto-generated commit · stdlib-js/string-base@94bcce4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 94bcce4

Browse files
committed
Auto-generated commit
1 parent 112c78a commit 94bcce4

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed

docs/types/index.d.ts

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@ import firstCodePoint = require( '@stdlib/string-base-first-code-point' );
3333
import firstGraphemeCluster = require( '@stdlib/string-base-first-grapheme-cluster' );
3434
import forEach = require( '@stdlib/string-base-for-each' );
3535
import forEachCodePoint = require( '@stdlib/string-base-for-each-code-point' );
36+
import forEachCodePointRight = require( '@stdlib/string-base-for-each-code-point-right' );
3637
import forEachGraphemeCluster = require( '@stdlib/string-base-for-each-grapheme-cluster' );
3738
import forEachRight = require( '@stdlib/string-base-for-each-right' );
3839
import formatInterpolate = require( '@stdlib/string-base-format-interpolate' );
3940
import formatTokenize = require( '@stdlib/string-base-format-tokenize' );
4041
import headercase = require( '@stdlib/string-base-headercase' );
4142
import invcase = require( '@stdlib/string-base-invcase' );
4243
import kebabcase = require( '@stdlib/string-base-kebabcase' );
44+
import last = require( '@stdlib/string-base-last' );
45+
import lastCodePoint = require( '@stdlib/string-base-last-code-point' );
46+
import lastGraphemeCluster = require( '@stdlib/string-base-last-grapheme-cluster' );
4347
import lpad = require( '@stdlib/string-base-left-pad' );
4448
import ltrim = require( '@stdlib/string-base-left-trim' );
4549
import lowercase = require( '@stdlib/string-base-lowercase' );
@@ -65,6 +69,7 @@ import rtrim = require( '@stdlib/string-base-right-trim' );
6569
import snakecase = require( '@stdlib/string-base-snakecase' );
6670
import startcase = require( '@stdlib/string-base-startcase' );
6771
import startsWith = require( '@stdlib/string-base-starts-with' );
72+
import stickycase = require( '@stdlib/string-base-stickycase' );
6873
import trim = require( '@stdlib/string-base-trim' );
6974
import truncateMiddle = require( '@stdlib/string-base-truncate-middle' );
7075
import uncapitalize = require( '@stdlib/string-base-uncapitalize' );
@@ -363,6 +368,31 @@ interface Namespace {
363368
*/
364369
forEachCodePoint: typeof forEachCodePoint;
365370

371+
/**
372+
* Invokes a function for each Unicode code point in a string, iterating from right to left.
373+
*
374+
* ## Notes
375+
*
376+
* - When invoked, the provided function is provided three arguments:
377+
*
378+
* - **value**: code point.
379+
* - **index**: starting code point index.
380+
* - **str**: input string.
381+
*
382+
* @param str - input string
383+
* @param clbk - function to invoke
384+
* @param thisArg - execution context
385+
* @returns input string
386+
*
387+
* @example
388+
* function log( value, index ) {
389+
* console.log( '%d: %s', index, value );
390+
* }
391+
*
392+
* ns.forEachCodePointRight( 'Hello, World!', log );
393+
*/
394+
forEachCodePointRight: typeof forEachCodePointRight;
395+
366396
/**
367397
* Invokes a function for each grapheme cluster (i.e., user-perceived character) in a string.
368398
*
@@ -504,6 +534,85 @@ interface Namespace {
504534
*/
505535
kebabcase: typeof kebabcase;
506536

537+
/**
538+
* Returns the last `n` UTF-16 code units of a string.
539+
*
540+
* @param str - input string
541+
* @param n - number of code units to return
542+
* @returns output string
543+
*
544+
* @example
545+
* var s = ns.last( 'hello world', 1 );
546+
* // returns 'd'
547+
*
548+
* @example
549+
* var s = ns.last( 'foo', 2 );
550+
* // returns 'oo'
551+
*
552+
* @example
553+
* var s = ns.last( 'JavaScript', 6 );
554+
* // returns 'Script'
555+
*
556+
* @example
557+
* var s = ns.last( 'foo bar', 10 );
558+
* // returns 'foo bar'
559+
*/
560+
last: typeof last;
561+
562+
/**
563+
* Returns the last `n` Unicode code points of a string.
564+
*
565+
* @param str - input string
566+
* @param n - number of code points to return
567+
* @returns output string
568+
*
569+
* @example
570+
* var out = ns.lastCodePoint( 'Hello World', 1 );
571+
* // returns 'd'
572+
*
573+
* @example
574+
* var out = ns.lastCodePoint( 'JavaScript', 6 );
575+
* // returns 'Script'
576+
*
577+
* @example
578+
* var out = ns.lastCodePoint( 'New', 5 );
579+
* // returns 'New'
580+
*
581+
* @example
582+
* var out = ns.lastCodePoint( 'अनुच्छेद', 1 );
583+
* // returns 'द'
584+
*/
585+
lastCodePoint: typeof lastCodePoint;
586+
587+
/**
588+
* Returns the last `n` grapheme clusters (i.e., user-perceived characters) of a string.
589+
*
590+
* @param str - input string
591+
* @param n - number of grapheme clusters to return
592+
* @returns output string
593+
*
594+
* @example
595+
* var out = ns.lastGraphemeCluster( 'Hello World', 1 );
596+
* // returns 'd'
597+
*
598+
* @example
599+
* var out = ns.lastGraphemeCluster( 'Evening', 3 );
600+
* // returns 'ing'
601+
*
602+
* @example
603+
* var out = ns.lastGraphemeCluster( 'JavaScript', 6 );
604+
* // returns 'Script'
605+
*
606+
* @example
607+
* var out = ns.lastGraphemeCluster( '🐶🐮🐷🐰🐸', 2 );
608+
* // returns '🐰🐸'
609+
*
610+
* @example
611+
* var out = ns.lastGraphemeCluster( 'foo bar', 5 );
612+
* // returns 'o bar'
613+
*/
614+
lastGraphemeCluster: typeof lastGraphemeCluster;
615+
507616
/**
508617
* Left pads a string such that the padded string has a length of at least `len`.
509618
*
@@ -1198,6 +1307,27 @@ interface Namespace {
11981307
*/
11991308
startsWith: typeof startsWith;
12001309

1310+
/**
1311+
* Converts a string to "sticky caps" case.
1312+
*
1313+
* @param str - input string
1314+
* @param p - probability of capitalization (default: 0.5)
1315+
* @returns sticky case string
1316+
*
1317+
* @example
1318+
* var str = ns.stickycase( 'hello world' );
1319+
* // returns <string>
1320+
*
1321+
* @example
1322+
* var str = ns.stickycase( 'hello world', 0.2 );
1323+
* // returns <string>
1324+
*
1325+
* @example
1326+
* var str = ns.stickycase( 'hello world', 0.8 );
1327+
* // returns <string>
1328+
*/
1329+
stickycase: typeof stickycase;
1330+
12011331
/**
12021332
* Trims whitespace characters from the beginning and end of a string.
12031333
*

0 commit comments

Comments
 (0)
0