Skip to content

Commit

Permalink
docs: fix errors in comments and clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Sep 22, 2024
1 parent 1ca9f87 commit b723a6e
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,28 @@
* limitations under the License.
*/

import mskrejectMap from './index';
import mskrejectMap = require( './index' );


// FUNCTIONS //

function timesTwo( val: number ): number {
return val * 2;
}

function identity( val: string ): string {
return val;
}


// TESTS //

// The function returns an array...
{
mskrejectMap( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ], function( val ) { return val * 2 } ); // $ExpectType number[]
mskrejectMap<any>( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ], function( val ) { return val * 2 } ); // $ExpectType any[]
mskrejectMap<number>( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ], function( val ) { return val * 2 } ); // $ExpectType number[]
mskrejectMap<string>( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ], function( val ) { return val } ); // $ExpectType string[]
mskrejectMap( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ], timesTwo ); // $ExpectType number[]
mskrejectMap<any>( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ], timesTwo ); // $ExpectType any[]
mskrejectMap<number>( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ], timesTwo ); // $ExpectType number[]
mskrejectMap<string>( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ], identity ); // $ExpectType string[]
}

// The compiler throws an error if the function is provided a first argument which is not an array-like object...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ interface Namespace {
*
* ## Notes
*
* - The function differs from the `===` operator in that the function treats ``NaNs` as the same value.
* - The function differs from the `===` operator in that the function treats `NaNs` as the same value.
*
* @param a - first input value
* @param b - second input value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* ## Notes
*
* - The function differs from the `===` operator in that the function treats ``NaNs` as the same value.
* - The function differs from the `===` operator in that the function treats `NaNs` as the same value.
*
* @param a - first input value
* @param b - second input value
Expand Down
2 changes: 1 addition & 1 deletion lib/node_modules/@stdlib/process/umask/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import umask = require( './index' );

// TESTS //

// The function returns a string or null...
// The function returns a string or number...
{
umask(); // $ExpectType string | number
umask( 0 ); // $ExpectType string | number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ interface Options {
* 'period': 10
* };
*
* var iter = iterBarlettHannPulse( opts );
* var iter = iterBartlettHannPulse( opts );
*
* var v = iter.next().value;
* // returns <number>
Expand All @@ -97,9 +97,9 @@ interface Options {
*
* // ...
*/
declare function iterBarlettHannPulse( options?: Options ): Iterator;
declare function iterBartlettHannPulse( options?: Options ): Iterator;


// EXPORTS //

export = iterBarlettHannPulse;
export = iterBartlettHannPulse;
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ interface Options {
* 'period': 10
* };
*
* var iter = iterBarlettPulse( opts );
* var iter = iterBartlettPulse( opts );
*
* var v = iter.next().value;
* // returns <number>
Expand All @@ -97,9 +97,9 @@ interface Options {
*
* // ...
*/
declare function iterBarlettPulse( options?: Options ): Iterator;
declare function iterBartlettPulse( options?: Options ): Iterator;


// EXPORTS //

export = iterBarlettPulse;
export = iterBartlettPulse;
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
* return capitalize( p1 );
* }
*
* var out = replace( str, /([^\s]*)/gi, replacer);
* var out = replace( str, /([^\s]*)/gi, replacer );
* // returns 'Oranges And Lemons Say The Bells Of St. Clement\'s'
*/
declare function repeat( str: string, search: RegExp, newval: string | Function ): string;
declare function replace( str: string, search: RegExp, newval: string | Function ): string;


// EXPORTS //

export = repeat;
export = replace;
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
* limitations under the License.
*/

import stickycase from './index';
import stickycase = require( './index' );


// TESTS //

Expand All @@ -39,13 +40,12 @@ import stickycase from './index';

// The compiler throws an error if the second parameter is not a number...
{
stickycase('hello world', true); // $ExpectError
stickycase('hello world', false); // $ExpectError
stickycase('hello world', undefined); // $ExpectError
stickycase('hello world', 'test'); // $ExpectError
stickycase('hello world', []); // $ExpectError
stickycase('hello world', {}); // $ExpectError
stickycase('hello world', (x: number): number => x); // $ExpectError
stickycase( 'hello world', true ); // $ExpectError
stickycase( 'hello world', false ); // $ExpectError
stickycase( 'hello world', 'test' ); // $ExpectError
stickycase( 'hello world', [] ); // $ExpectError
stickycase( 'hello world', {} ); // $ExpectError
stickycase( 'hello world', ( x: number ): number => x ); // $ExpectError
}

// The compiler throws an error if the function is provided insufficient arguments...
Expand Down

0 comments on commit b723a6e

Please sign in to comment.