Skip to content

Commit 89910da

Browse files
stdlib-botkgryte
andauthored
feat: update namespace TypeScript declarations
PR-URL: stdlib-js#1068 Co-authored-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 0a0d792 commit 89910da

File tree

3 files changed

+262
-28
lines changed

3 files changed

+262
-28
lines changed

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

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,19 +1597,43 @@ interface Namespace {
15971597
cceiln: typeof cceiln;
15981598

15991599
/**
1600-
* Computes the cis function of a complex number.
1600+
* Evaluates the cis function for a double-precision complex floating-point number.
16011601
*
1602-
* @param re - real component
1603-
* @param im - imaginary component
1604-
* @returns real and imaginary components
1602+
* @param z - complex number
1603+
* @returns result
16051604
*
16061605
* @example
1607-
* var v = ns.ccis( 0.0, 0.0 );
1608-
* // returns [ 1.0, 0.0 ]
1606+
* var Complex128 = require( `@stdlib/complex/float64` );
1607+
* var real = require( `@stdlib/complex/real` );
1608+
* var imag = require( `@stdlib/complex/imag` );
1609+
*
1610+
* var z = new Complex128( 0.0, 0.0 );
1611+
* // returns <Complex128>
1612+
*
1613+
* var out = cccis( z );
1614+
* // returns <Complex128>
1615+
*
1616+
* var re = real( out );
1617+
* // returns 1.0
16091618
*
1619+
* var im = imag( out );
1620+
* // returns 0.0
16101621
* @example
1611-
* var v = ns.ccis( 1.0, 0.0 );
1612-
* // returns [ ~0.540, ~0.841 ]
1622+
* var Complex128 = require( `@stdlib/complex/float64` );
1623+
* var real = require( `@stdlib/complex/real` );
1624+
* var imag = require( `@stdlib/complex/imag` );
1625+
*
1626+
* var z = new Complex128( 1.0, 0.0 );
1627+
* // returns <Complex128>
1628+
*
1629+
* var out = cccis( z );
1630+
* // returns <Complex128>
1631+
*
1632+
* var re = real( out );
1633+
* // returns ~0.540
1634+
*
1635+
* var im = imag( out );
1636+
* // returns ~0.841
16131637
*/
16141638
ccis: typeof ccis;
16151639

@@ -1947,15 +1971,24 @@ interface Namespace {
19471971
cidentityf: typeof cidentityf;
19481972

19491973
/**
1950-
* Computes the inverse of a complex number.
1974+
* Computes the inverse of a double-precision complex floating-point number.
19511975
*
1952-
* @param re - real component
1953-
* @param im - imaginary component
1954-
* @returns real and imaginary components
1976+
* @param z - input value
1977+
* @returns result
19551978
*
19561979
* @example
1957-
* var v = ns.cinv( 2.0, 4.0 );
1958-
* // returns [ 0.1, -0.2 ]
1980+
* var Complex128 = require( `@stdlib/complex/float64` );
1981+
* var real = require( `@stdlib/complex/real` );
1982+
* var imag = require( `@stdlib/complex/imag` );
1983+
*
1984+
* var v = ns.cinv( new Complex128( 2.0, 4.0 ) );
1985+
* // returns <Complex128>
1986+
*
1987+
* var re = real( v );
1988+
* // returns 0.1
1989+
*
1990+
* var im = imag( v );
1991+
* // returns -0.2
19591992
*/
19601993
cinv: typeof cinv;
19611994

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

Lines changed: 180 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@ import camelcase = require( '@stdlib/string/base/camelcase' );
2525
import capitalize = require( '@stdlib/string/base/capitalize' );
2626
import codePointAt = require( '@stdlib/string/base/code-point-at' );
2727
import constantcase = require( '@stdlib/string/base/constantcase' );
28+
import distances = require( '@stdlib/string/base/distances' );
2829
import dotcase = require( '@stdlib/string/base/dotcase' );
2930
import endsWith = require( '@stdlib/string/base/ends-with' );
31+
import first = require( '@stdlib/string/base/first' );
32+
import firstCodePoint = require( '@stdlib/string/base/first-code-point' );
33+
import firstGraphemeCluster = require( '@stdlib/string/base/first-grapheme-cluster' );
34+
import forEach = require( '@stdlib/string/base/for-each' );
35+
import forEachCodePoint = require( '@stdlib/string/base/for-each-code-point' );
36+
import forEachGraphemeCluster = require( '@stdlib/string/base/for-each-grapheme-cluster' );
3037
import formatInterpolate = require( '@stdlib/string/base/format-interpolate' );
3138
import formatTokenize = require( '@stdlib/string/base/format-tokenize' );
3239
import headercase = require( '@stdlib/string/base/headercase' );
@@ -134,6 +141,11 @@ interface Namespace {
134141
*/
135142
constantcase: typeof constantcase;
136143

144+
/**
145+
* Implementations of various string similarity metrics.
146+
*/
147+
distances: typeof distances;
148+
137149
/**
138150
* Converts a string to dot case.
139151
*
@@ -176,6 +188,172 @@ interface Namespace {
176188
*/
177189
endsWith: typeof endsWith;
178190

191+
/**
192+
* Returns the first `n` UTF-16 code units of a string.
193+
*
194+
* @param str - input string
195+
* @param n - number of code units to return
196+
* @returns output string
197+
*
198+
* @example
199+
* var out = ns.first( 'last man standing', 1 );
200+
* // returns 'l'
201+
*
202+
* @example
203+
* var out = ns.first( 'presidential election', 1 );
204+
* // returns 'p'
205+
*
206+
* @example
207+
* var out = ns.first( 'JavaScript', 1 );
208+
* // returns 'J'
209+
*
210+
* @example
211+
* var out = ns.first( 'Hidden Treasures', 1 );
212+
* // returns 'H'
213+
*
214+
* @example
215+
* var out = ns.first( 'foo bar', 5 );
216+
* // returns 'foo b'
217+
*/
218+
first: typeof first;
219+
220+
/**
221+
* Returns the first `n` Unicode code points of a string.
222+
*
223+
* @param str - input string
224+
* @param n - number of code points to return
225+
* @returns output string
226+
*
227+
* @example
228+
* var out = ns.firstCodePoint( 'last man standing', 1 );
229+
* // returns 'l'
230+
*
231+
* @example
232+
* var out = ns.firstCodePoint( 'presidential election', 1 );
233+
* // returns 'p'
234+
*
235+
* @example
236+
* var out = ns.firstCodePoint( 'JavaScript', 1 );
237+
* // returns 'J'
238+
*
239+
* @example
240+
* var out = ns.firstCodePoint( 'Hidden Treasures', 1 );
241+
* // returns 'H'
242+
*
243+
* @example
244+
* var out = ns.firstCodePoint( 'foo bar', 5 );
245+
* // returns 'foo b'
246+
*/
247+
firstCodePoint: typeof firstCodePoint;
248+
249+
/**
250+
* Returns the first `n` grapheme clusters (i.e., user-perceived characters) of a string.
251+
*
252+
* @param str - input string
253+
* @param n - number of grapheme clusters to return
254+
* @returns output string
255+
*
256+
* @example
257+
* var out = ns.firstGraphemeCluster( 'last man standing', 1 );
258+
* // returns 'l'
259+
*
260+
* @example
261+
* var out = ns.firstGraphemeCluster( 'presidential election', 1 );
262+
* // returns 'p'
263+
*
264+
* @example
265+
* var out = ns.firstGraphemeCluster( 'JavaScript', 1 );
266+
* // returns 'J'
267+
*
268+
* @example
269+
* var out = ns.firstGraphemeCluster( 'Hidden Treasures', 1 );
270+
* // returns 'H'
271+
*
272+
* @example
273+
* var out = ns.firstGraphemeCluster( '🐶🐮🐷🐰🐸', 2 );
274+
* // returns '🐶🐮'
275+
*
276+
* @example
277+
* var out = ns.firstGraphemeCluster( 'foo bar', 5 );
278+
* // returns 'foo b'
279+
*/
280+
firstGraphemeCluster: typeof firstGraphemeCluster;
281+
282+
/**
283+
* Invokes a function for each UTF-16 code unit in a string.
284+
*
285+
* ## Notes
286+
*
287+
* - When invoked, the provided function is provided three arguments:
288+
*
289+
* - **value**: character.
290+
* - **index**: character index.
291+
* - **str**: input string.
292+
*
293+
* @param str - input string
294+
* @param clbk - function to invoke
295+
* @param thisArg - execution context
296+
* @returns input string
297+
*
298+
* @example
299+
* function log( value, index ) {
300+
* console.log( '%d: %s', index, value );
301+
* }
302+
*
303+
* ns.forEach( 'Hello, World!', log );
304+
*/
305+
forEach: typeof forEach;
306+
307+
/**
308+
* Invokes a function for each Unicode code point in a string.
309+
*
310+
* ## Notes
311+
*
312+
* - When invoked, the provided function is provided three arguments:
313+
*
314+
* - **value**: code point.
315+
* - **index**: starting code point index.
316+
* - **str**: input string.
317+
*
318+
* @param str - input string
319+
* @param clbk - function to invoke
320+
* @param thisArg - execution context
321+
* @returns input string
322+
*
323+
* @example
324+
* function log( value, index ) {
325+
* console.log( '%d: %s', index, value );
326+
* }
327+
*
328+
* ns.forEachCodePoint( 'Hello, World!', log );
329+
*/
330+
forEachCodePoint: typeof forEachCodePoint;
331+
332+
/**
333+
* Invokes a function for each grapheme cluster (i.e., user-perceived character) in a string.
334+
*
335+
* ## Notes
336+
*
337+
* - When invoked, the provided function is provided three arguments:
338+
*
339+
* - **value**: grapheme cluster.
340+
* - **index**: starting grapheme cluster index.
341+
* - **str**: input string.
342+
*
343+
* @param str - input string
344+
* @param clbk - function to invoke
345+
* @param thisArg - execution context
346+
* @returns input string
347+
*
348+
* @example
349+
* function log( value, index ) {
350+
* console.log( '%d: %s', index, value );
351+
* }
352+
*
353+
* ns.forEachGraphemeCluster( 'Hello, World!', log );
354+
*/
355+
forEachGraphemeCluster: typeof forEachGraphemeCluster;
356+
179357
/**
180358
* Generates string from a token array by interpolating values.
181359
*
@@ -204,10 +382,10 @@ interface Namespace {
204382
formatTokenize: typeof formatTokenize;
205383

206384
/**
207-
* Converts a string to Header case.
385+
* Converts a string to HTTP header case.
208386
*
209387
* @param str - string to convert
210-
* @returns Header-cased string
388+
* @returns HTTP header-cased string
211389
*
212390
* @example
213391
* var str = ns.headercase( 'Hello World!' );

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

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import first = require( '@stdlib/string/first' );
3333
import forEach = require( '@stdlib/string/for-each' );
3434
import format = require( '@stdlib/string/format' );
3535
import fromCodePoint = require( '@stdlib/string/from-code-point' );
36+
import headercase = require( '@stdlib/string/headercase' );
3637
import kebabcase = require( '@stdlib/string/kebabcase' );
3738
import lpad = require( '@stdlib/string/left-pad' );
3839
import ltrim = require( '@stdlib/string/left-trim' );
@@ -243,7 +244,7 @@ interface Namespace {
243244
endsWith: typeof endsWith;
244245

245246
/**
246-
* Removes the first visual character(s) of a string.
247+
* Returns the first character(s) of a string.
247248
*
248249
* @param str - input string
249250
* @param n - number of characters to return (default: 1)
@@ -276,29 +277,31 @@ interface Namespace {
276277
first: typeof first;
277278

278279
/**
279-
* Invokes a callback once for each (visual) character of a string.
280+
* Invokes a function for each character in a string.
280281
*
281282
* ## Notes
282283
*
283-
* - When invoked, the input function is provided three arguments:
284+
* - When invoked, the provided function is provided three arguments:
284285
*
285-
* - `value`: visual character
286-
* - `index`: starting character index
287-
* - `inpStr`: input string
286+
* - **value**: character.
287+
* - **index**: starting character index.
288+
* - **str**: input string.
288289
*
289290
* @param str - input string
291+
* @param options - options
290292
* @param clbk - function to invoke
291293
* @param thisArg - execution context
292294
* @returns input string
293295
*
294296
* @example
295-
* function log( value, index, inpStr ) {
296-
* console.log( '%s: %d', index, value );
297+
* function log( value, index ) {
298+
* console.log( '%d: %s', index, value );
297299
* }
298300
*
299-
* var testStr = 'presidential election';
300-
*
301-
* ns.forEach( testStr, log );
301+
* var opts = {
302+
* 'mode': 'code_point'
303+
* };
304+
* ns.forEach( 'Hello, World!', opts, log );
302305
*/
303306
forEach: typeof forEach;
304307

@@ -339,6 +342,26 @@ interface Namespace {
339342
*/
340343
fromCodePoint: typeof fromCodePoint;
341344

345+
/**
346+
* Converts a string to HTTP header case.
347+
*
348+
* @param str - string to convert
349+
* @returns HTTP header-cased string
350+
*
351+
* @example
352+
* var str = ns.headercase( 'Hello World!' );
353+
* // returns 'Hello-World'
354+
*
355+
* @example
356+
* var str = ns.headercase( 'foo_bar' );
357+
* // returns 'Foo-Bar'
358+
*
359+
* @example
360+
* var str = ns.headercase( 'foo-bar' );
361+
* // returns 'Foo-Bar'
362+
*/
363+
headercase: typeof headercase;
364+
342365
/**
343366
* Converts a string to kebab case.
344367
*
@@ -636,7 +659,7 @@ interface Namespace {
636659
* // returns 'residential election'
637660
*
638661
* @example
639-
* var out = ns.removeFirst( 'javaScript' );
662+
* var out = ns.removeFirst( 'JavaScript' );
640663
* // returns 'avaScript'
641664
*
642665
* @example

0 commit comments

Comments
 (0)