From 89910daae54261b8fd21ee548b1a608aa0c65f12 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Fri, 21 Jul 2023 16:37:57 -0400 Subject: [PATCH] feat: update namespace TypeScript declarations PR-URL: https://github.com/stdlib-js/stdlib/pull/1068 Co-authored-by: Athan Reines Reviewed-by: Athan Reines --- .../math/base/special/docs/types/index.d.ts | 61 ++++-- .../@stdlib/string/base/docs/types/index.d.ts | 182 +++++++++++++++++- .../@stdlib/string/docs/types/index.d.ts | 47 +++-- 3 files changed, 262 insertions(+), 28 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/docs/types/index.d.ts index 5fee58e75a3..7deab3cc7ba 100644 --- a/lib/node_modules/@stdlib/math/base/special/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/math/base/special/docs/types/index.d.ts @@ -1597,19 +1597,43 @@ interface Namespace { cceiln: typeof cceiln; /** - * Computes the cis function of a complex number. + * Evaluates the cis function for a double-precision complex floating-point number. * - * @param re - real component - * @param im - imaginary component - * @returns real and imaginary components + * @param z - complex number + * @returns result * * @example - * var v = ns.ccis( 0.0, 0.0 ); - * // returns [ 1.0, 0.0 ] + * var Complex128 = require( `@stdlib/complex/float64` ); + * var real = require( `@stdlib/complex/real` ); + * var imag = require( `@stdlib/complex/imag` ); + * + * var z = new Complex128( 0.0, 0.0 ); + * // returns + * + * var out = cccis( z ); + * // returns + * + * var re = real( out ); + * // returns 1.0 * + * var im = imag( out ); + * // returns 0.0 * @example - * var v = ns.ccis( 1.0, 0.0 ); - * // returns [ ~0.540, ~0.841 ] + * var Complex128 = require( `@stdlib/complex/float64` ); + * var real = require( `@stdlib/complex/real` ); + * var imag = require( `@stdlib/complex/imag` ); + * + * var z = new Complex128( 1.0, 0.0 ); + * // returns + * + * var out = cccis( z ); + * // returns + * + * var re = real( out ); + * // returns ~0.540 + * + * var im = imag( out ); + * // returns ~0.841 */ ccis: typeof ccis; @@ -1947,15 +1971,24 @@ interface Namespace { cidentityf: typeof cidentityf; /** - * Computes the inverse of a complex number. + * Computes the inverse of a double-precision complex floating-point number. * - * @param re - real component - * @param im - imaginary component - * @returns real and imaginary components + * @param z - input value + * @returns result * * @example - * var v = ns.cinv( 2.0, 4.0 ); - * // returns [ 0.1, -0.2 ] + * var Complex128 = require( `@stdlib/complex/float64` ); + * var real = require( `@stdlib/complex/real` ); + * var imag = require( `@stdlib/complex/imag` ); + * + * var v = ns.cinv( new Complex128( 2.0, 4.0 ) ); + * // returns + * + * var re = real( v ); + * // returns 0.1 + * + * var im = imag( v ); + * // returns -0.2 */ cinv: typeof cinv; diff --git a/lib/node_modules/@stdlib/string/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/string/base/docs/types/index.d.ts index 4e7b2f3d9b2..e6fb918c1ea 100644 --- a/lib/node_modules/@stdlib/string/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/string/base/docs/types/index.d.ts @@ -25,8 +25,15 @@ import camelcase = require( '@stdlib/string/base/camelcase' ); import capitalize = require( '@stdlib/string/base/capitalize' ); import codePointAt = require( '@stdlib/string/base/code-point-at' ); import constantcase = require( '@stdlib/string/base/constantcase' ); +import distances = require( '@stdlib/string/base/distances' ); import dotcase = require( '@stdlib/string/base/dotcase' ); import endsWith = require( '@stdlib/string/base/ends-with' ); +import first = require( '@stdlib/string/base/first' ); +import firstCodePoint = require( '@stdlib/string/base/first-code-point' ); +import firstGraphemeCluster = require( '@stdlib/string/base/first-grapheme-cluster' ); +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 formatInterpolate = require( '@stdlib/string/base/format-interpolate' ); import formatTokenize = require( '@stdlib/string/base/format-tokenize' ); import headercase = require( '@stdlib/string/base/headercase' ); @@ -134,6 +141,11 @@ interface Namespace { */ constantcase: typeof constantcase; + /** + * Implementations of various string similarity metrics. + */ + distances: typeof distances; + /** * Converts a string to dot case. * @@ -176,6 +188,172 @@ interface Namespace { */ endsWith: typeof endsWith; + /** + * Returns the first `n` UTF-16 code units of a string. + * + * @param str - input string + * @param n - number of code units to return + * @returns output string + * + * @example + * var out = ns.first( 'last man standing', 1 ); + * // returns 'l' + * + * @example + * var out = ns.first( 'presidential election', 1 ); + * // returns 'p' + * + * @example + * var out = ns.first( 'JavaScript', 1 ); + * // returns 'J' + * + * @example + * var out = ns.first( 'Hidden Treasures', 1 ); + * // returns 'H' + * + * @example + * var out = ns.first( 'foo bar', 5 ); + * // returns 'foo b' + */ + first: typeof first; + + /** + * Returns the first `n` Unicode code points of a string. + * + * @param str - input string + * @param n - number of code points to return + * @returns output string + * + * @example + * var out = ns.firstCodePoint( 'last man standing', 1 ); + * // returns 'l' + * + * @example + * var out = ns.firstCodePoint( 'presidential election', 1 ); + * // returns 'p' + * + * @example + * var out = ns.firstCodePoint( 'JavaScript', 1 ); + * // returns 'J' + * + * @example + * var out = ns.firstCodePoint( 'Hidden Treasures', 1 ); + * // returns 'H' + * + * @example + * var out = ns.firstCodePoint( 'foo bar', 5 ); + * // returns 'foo b' + */ + firstCodePoint: typeof firstCodePoint; + + /** + * Returns the first `n` grapheme clusters (i.e., user-perceived characters) of a string. + * + * @param str - input string + * @param n - number of grapheme clusters to return + * @returns output string + * + * @example + * var out = ns.firstGraphemeCluster( 'last man standing', 1 ); + * // returns 'l' + * + * @example + * var out = ns.firstGraphemeCluster( 'presidential election', 1 ); + * // returns 'p' + * + * @example + * var out = ns.firstGraphemeCluster( 'JavaScript', 1 ); + * // returns 'J' + * + * @example + * var out = ns.firstGraphemeCluster( 'Hidden Treasures', 1 ); + * // returns 'H' + * + * @example + * var out = ns.firstGraphemeCluster( '🐶🐮🐷🐰🐸', 2 ); + * // returns '🐶🐮' + * + * @example + * var out = ns.firstGraphemeCluster( 'foo bar', 5 ); + * // returns 'foo b' + */ + firstGraphemeCluster: typeof firstGraphemeCluster; + + /** + * Invokes a function for each UTF-16 code unit in a string. + * + * ## 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 ); + * } + * + * ns.forEach( 'Hello, World!', log ); + */ + forEach: typeof forEach; + + /** + * Invokes a function for each Unicode code point in a string. + * + * ## Notes + * + * - When invoked, the provided function is provided three arguments: + * + * - **value**: code point. + * - **index**: starting code point 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 ); + * } + * + * ns.forEachCodePoint( 'Hello, World!', log ); + */ + forEachCodePoint: typeof forEachCodePoint; + + /** + * Invokes a function for each grapheme cluster (i.e., user-perceived character) in a string. + * + * ## Notes + * + * - When invoked, the provided function is provided three arguments: + * + * - **value**: grapheme cluster. + * - **index**: starting grapheme cluster 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 ); + * } + * + * ns.forEachGraphemeCluster( 'Hello, World!', log ); + */ + forEachGraphemeCluster: typeof forEachGraphemeCluster; + /** * Generates string from a token array by interpolating values. * @@ -204,10 +382,10 @@ interface Namespace { formatTokenize: typeof formatTokenize; /** - * Converts a string to Header case. + * Converts a string to HTTP header case. * * @param str - string to convert - * @returns Header-cased string + * @returns HTTP header-cased string * * @example * var str = ns.headercase( 'Hello World!' ); diff --git a/lib/node_modules/@stdlib/string/docs/types/index.d.ts b/lib/node_modules/@stdlib/string/docs/types/index.d.ts index 841f98ba2c8..ef6bc3714b4 100644 --- a/lib/node_modules/@stdlib/string/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/string/docs/types/index.d.ts @@ -33,6 +33,7 @@ import first = require( '@stdlib/string/first' ); import forEach = require( '@stdlib/string/for-each' ); import format = require( '@stdlib/string/format' ); import fromCodePoint = require( '@stdlib/string/from-code-point' ); +import headercase = require( '@stdlib/string/headercase' ); import kebabcase = require( '@stdlib/string/kebabcase' ); import lpad = require( '@stdlib/string/left-pad' ); import ltrim = require( '@stdlib/string/left-trim' ); @@ -243,7 +244,7 @@ interface Namespace { endsWith: typeof endsWith; /** - * Removes the first visual character(s) of a string. + * Returns the first character(s) of a string. * * @param str - input string * @param n - number of characters to return (default: 1) @@ -276,29 +277,31 @@ interface Namespace { first: typeof first; /** - * Invokes a callback once for each (visual) character of a string. + * Invokes a function for each character in a string. * * ## Notes * - * - When invoked, the input function is provided three arguments: + * - When invoked, the provided function is provided three arguments: * - * - `value`: visual character - * - `index`: starting character index - * - `inpStr`: input string + * - **value**: character. + * - **index**: starting character index. + * - **str**: input string. * * @param str - input string + * @param options - options * @param clbk - function to invoke * @param thisArg - execution context * @returns input string * * @example - * function log( value, index, inpStr ) { - * console.log( '%s: %d', index, value ); + * function log( value, index ) { + * console.log( '%d: %s', index, value ); * } * - * var testStr = 'presidential election'; - * - * ns.forEach( testStr, log ); + * var opts = { + * 'mode': 'code_point' + * }; + * ns.forEach( 'Hello, World!', opts, log ); */ forEach: typeof forEach; @@ -339,6 +342,26 @@ interface Namespace { */ fromCodePoint: typeof fromCodePoint; + /** + * Converts a string to HTTP header case. + * + * @param str - string to convert + * @returns HTTP header-cased string + * + * @example + * var str = ns.headercase( 'Hello World!' ); + * // returns 'Hello-World' + * + * @example + * var str = ns.headercase( 'foo_bar' ); + * // returns 'Foo-Bar' + * + * @example + * var str = ns.headercase( 'foo-bar' ); + * // returns 'Foo-Bar' + */ + headercase: typeof headercase; + /** * Converts a string to kebab case. * @@ -636,7 +659,7 @@ interface Namespace { * // returns 'residential election' * * @example - * var out = ns.removeFirst( 'javaScript' ); + * var out = ns.removeFirst( 'JavaScript' ); * // returns 'avaScript' * * @example