Skip to content

Commit 810ebc1

Browse files
stdlib-botkgryte
andauthored
feat: update namespace TypeScript declarations
PR-URL: stdlib-js#1047 Co-authored-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 02da8f1 commit 810ebc1

File tree

4 files changed

+131
-23
lines changed

4 files changed

+131
-23
lines changed

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import datespace = require( '@stdlib/array/datespace' );
3333
import arrayDataType = require( '@stdlib/array/dtype' );
3434
import arrayDataTypes = require( '@stdlib/array/dtypes' );
3535
import aempty = require( '@stdlib/array/empty' );
36+
import aemptyLike = require( '@stdlib/array/empty-like' );
3637
import filledarray = require( '@stdlib/array/filled' );
3738
import filledarrayBy = require( '@stdlib/array/filled-by' );
3839
import Float32Array = require( '@stdlib/array/float32' );
@@ -398,6 +399,54 @@ interface Namespace {
398399
*/
399400
aempty: typeof aempty;
400401

402+
/**
403+
* Creates an uninitialized array having the same length and data type as a provided input array.
404+
*
405+
* ## Notes
406+
*
407+
* - In browser environments, the function always returns zero-filled arrays.
408+
* - If `dtype` is `'generic'`, the function always returns a zero-filled array.
409+
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
410+
*
411+
* The function recognizes the following data types:
412+
*
413+
* - `float64`: double-precision floating-point numbers (IEEE 754)
414+
* - `float32`: single-precision floating-point numbers (IEEE 754)
415+
* - `complex128`: double-precision complex floating-point numbers
416+
* - `complex64`: single-precision complex floating-point numbers
417+
* - `int32`: 32-bit two's complement signed integers
418+
* - `uint32`: 32-bit unsigned integers
419+
* - `int16`: 16-bit two's complement signed integers
420+
* - `uint16`: 16-bit unsigned integers
421+
* - `int8`: 8-bit two's complement signed integers
422+
* - `uint8`: 8-bit unsigned integers
423+
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
424+
* - `generic`: generic JavaScript values
425+
*
426+
* @param x - input array from which to derive the output array length
427+
* @param dtype - data type
428+
* @returns empty array
429+
*
430+
* @example
431+
* var zeros = require( `@stdlib/array/zeros` );
432+
*
433+
* var x = zeros( 2, 'float32' );
434+
* // returns <Float32Array>[ 0.0, 0.0 ]
435+
*
436+
* var arr = ns.aemptyLike( x );
437+
* // returns <Float32Array>
438+
*
439+
* @example
440+
* var zeros = require( `@stdlib/array/zeros` );
441+
*
442+
* var x = zeros( 2, 'float64' );
443+
* // returns <Float32Array>[ 0.0, 0.0 ]
444+
*
445+
* var arr = ns.aemptyLike( x );
446+
* // returns <Float64Array>
447+
*/
448+
aemptyLike: typeof aemptyLike;
449+
401450
/**
402451
* Returns a filled typed array view of an `ArrayBuffer`.
403452
*

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

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,18 +2284,19 @@ interface Namespace {
22842284
coversin: typeof coversin;
22852285

22862286
/**
2287-
* Computes the argument of a complex number in radians.
2287+
* Computes the argument of a double-precision complex floating-point number in radians.
22882288
*
22892289
* ## Notes
22902290
*
22912291
* - The argument of a complex number, also known as the phase, is the angle of the radius extending from the origin to the complex number plotted in the complex plane and the positive real axis.
22922292
*
2293-
* @param re - real component
2294-
* @param im - imaginary component
2293+
* @param z - complex number
22952294
* @returns argument
22962295
*
22972296
* @example
2298-
* var phi = ns.cphase( 5.0, 3.0 );
2297+
* var Complex128 = require( `@stdlib/complex/float64` );
2298+
*
2299+
* var phi = ns.cphase( new Complex128( 5.0, 3.0 ) );
22992300
* // returns ~0.5404
23002301
*/
23012302
cphase: typeof cphase;
@@ -2314,15 +2315,24 @@ interface Namespace {
23142315
cpolar: typeof cpolar;
23152316

23162317
/**
2317-
* Rounds a complex number to the nearest integer.
2318+
* Rounds each component of a double-precision complex floating-point number to the nearest integer.
23182319
*
2319-
* @param re - real component
2320-
* @param im - imaginary component
2321-
* @returns real and imaginary components
2320+
* @param z - input value
2321+
* @returns result
23222322
*
23232323
* @example
2324-
* var out = ns.cround( 5.5, 3.3 );
2325-
* // returns [ 6.0, 3.0 ]
2324+
* var Complex128 = require( `@stdlib/complex/float64` );
2325+
* var real = require( `@stdlib/complex/real` );
2326+
* var imag = require( `@stdlib/complex/imag` );
2327+
*
2328+
* var v = cceil( new Complex128( -4.2, 5.5 ) );
2329+
* // returns <Complex128>
2330+
*
2331+
* var re = real( v );
2332+
* // returns -4.0
2333+
*
2334+
* var im = imag( v );
2335+
* // returns 6.0
23262336
*/
23272337
cround: typeof cround;
23282338

@@ -2369,23 +2379,24 @@ interface Namespace {
23692379
csch: typeof csch;
23702380

23712381
/**
2372-
* Evaluates the signum function of a complex number.
2382+
* Evaluates the signum function of a double-precision complex floating-point number.
23732383
*
2374-
* @param re - real component
2375-
* @param im - imaginary component
2376-
* @returns real and imaginary components
2384+
* @param z - input value
2385+
* @returns result
23772386
*
23782387
* @example
2379-
* var v = ns.csignum( -4.2, 5.5 );
2380-
* // returns [ -0.6069136033622302, 0.79476781392673 ]
2388+
* var Complex128 = require( `@stdlib/complex/float64` );
2389+
* var real = require( `@stdlib/complex/real` );
2390+
* var imag = require( `@stdlib/complex/imag` );
23812391
*
2382-
* @example
2383-
* var v = ns.csignum( 0.0, 0.0 );
2384-
* // returns [ 0.0, 0.0 ]
2392+
* var v = cceil( new Complex128( -4.2, 5.5 ) );
2393+
* // returns <Complex128>
23852394
*
2386-
* @example
2387-
* var v = ns.csignum( NaN, NaN );
2388-
* // returns [ NaN, NaN ]
2395+
* var re = real( v );
2396+
* // returns -0.6069136033622302
2397+
*
2398+
* var im = imag( v );
2399+
* // returns 0.79476781392673
23892400
*/
23902401
csignum: typeof csignum;
23912402

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ interface Namespace {
4242
* var dist = ns.levenshteinDistance( 'algorithm', 'altruistic' );
4343
* // returns 6
4444
*
45-
*
4645
* @example
4746
* var dist = ns.levenshteinDistance( 'hippo', 'elephant' );
4847
* // returns 7

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ import camelcase = require( '@stdlib/string/camelcase' );
2727
import capitalize = require( '@stdlib/string/capitalize' );
2828
import codePointAt = require( '@stdlib/string/code-point-at' );
2929
import constantcase = require( '@stdlib/string/constantcase' );
30+
import dotcase = require( '@stdlib/string/dotcase' );
3031
import endsWith = require( '@stdlib/string/ends-with' );
3132
import first = require( '@stdlib/string/first' );
33+
import forEach = require( '@stdlib/string/for-each' );
3234
import format = require( '@stdlib/string/format' );
3335
import fromCodePoint = require( '@stdlib/string/from-code-point' );
3436
import kebabcase = require( '@stdlib/string/kebabcase' );
@@ -186,6 +188,26 @@ interface Namespace {
186188
*/
187189
constantcase: typeof constantcase;
188190

191+
/**
192+
* Converts a string to dot case.
193+
*
194+
* @param str - string to convert
195+
* @returns dot-cased string
196+
*
197+
* @example
198+
* var str = ns.dotcase( 'Hello World!' );
199+
* // returns 'hello.world'
200+
*
201+
* @example
202+
* var str = ns.dotcase( 'foo_bar' );
203+
* // returns 'foo.bar'
204+
*
205+
* @example
206+
* var str = ns.dotcase( 'foo-bar' );
207+
* // returns 'foo.bar'
208+
*/
209+
dotcase: typeof dotcase;
210+
189211
/**
190212
* Tests if a string ends with the characters of another string.
191213
*
@@ -253,6 +275,33 @@ interface Namespace {
253275
*/
254276
first: typeof first;
255277

278+
/**
279+
* Invokes a callback once for each (visual) character of a string.
280+
*
281+
* ## Notes
282+
*
283+
* - When invoked, the input function is provided three arguments:
284+
*
285+
* - `value`: visual character
286+
* - `index`: starting character index
287+
* - `inpStr`: input string
288+
*
289+
* @param str - input string
290+
* @param clbk - function to invoke
291+
* @param thisArg - execution context
292+
* @returns input string
293+
*
294+
* @example
295+
* function log( value, index, inpStr ) {
296+
* console.log( '%s: %d', index, value );
297+
* }
298+
*
299+
* var testStr = 'presidential election';
300+
*
301+
* ns.forEach( testStr, log );
302+
*/
303+
forEach: typeof forEach;
304+
256305
/**
257306
* Inserts supplied variable values into a format string.
258307
*

0 commit comments

Comments
 (0)