Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions lib/node_modules/@stdlib/complex/base/cast-return/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,16 @@ The function accepts the following arguments:
```javascript
var Complex64 = require( '@stdlib/complex/float32/ctor' );
var addf = require( '@stdlib/number/float32/base/add' );
var realf = require( '@stdlib/complex/float32/real' );
var imagf = require( '@stdlib/complex/float32/imag' );
var castReturn = require( '@stdlib/complex/base/cast-return' );

var f = castReturn( addf, 2, Complex64 );

// ...

var z = f( 3.0, 4.0 );
// returns <Complex64>
// returns <Complex64>[ 7.0, 0.0 ]

var re = realf( z );
// returns 7.0

var im = imagf( z );
// returns 0.0

console.log( '%d + %di', re, im );
console.log( z.toString() );
// => '7 + 0i'
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@
--------
> var f = {{alias}}( {{alias:@stdlib/number/float32/base/add}}, 2, {{alias:@stdlib/complex/float32/ctor}} );
> var z = f( 3.0, 4.0 )
<Complex64>
> var re = {{alias:@stdlib/complex/float32/real}}( z )
7.0
> var im = {{alias:@stdlib/complex/float32/imag}}( z )
0.0
<Complex64>[ 7.0, 0.0 ]

See Also
--------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* @param x - input value
* @returns result
*/
type Unary = ( x: any ) => RealOrComplex;

Check warning on line 50 in lib/node_modules/@stdlib/complex/base/cast-return/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type

/**
* Unary function returning a complex number.
Expand All @@ -55,7 +55,7 @@
* @param x - input value
* @returns result
*/
type WrappedUnary = ( x: any ) => ComplexLike;

Check warning on line 58 in lib/node_modules/@stdlib/complex/base/cast-return/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type

/**
* Binary function returning either a real or complex number.
Expand All @@ -64,7 +64,7 @@
* @param y - input value
* @returns result
*/
type Binary = ( x: any, y: any ) => RealOrComplex;

Check warning on line 67 in lib/node_modules/@stdlib/complex/base/cast-return/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type

Check warning on line 67 in lib/node_modules/@stdlib/complex/base/cast-return/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type

/**
* Binary function returning a complex number.
Expand All @@ -73,7 +73,7 @@
* @param y - input value
* @returns result
*/
type WrappedBinary = ( x: any, y: any ) => ComplexLike;

Check warning on line 76 in lib/node_modules/@stdlib/complex/base/cast-return/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type

Check warning on line 76 in lib/node_modules/@stdlib/complex/base/cast-return/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type

/**
* Ternary function returning either a real or complex number.
Expand All @@ -83,7 +83,7 @@
* @param z - input value
* @returns result
*/
type Ternary = ( x: any, y: any, z: any ) => RealOrComplex;

Check warning on line 86 in lib/node_modules/@stdlib/complex/base/cast-return/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type

Check warning on line 86 in lib/node_modules/@stdlib/complex/base/cast-return/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type

Check warning on line 86 in lib/node_modules/@stdlib/complex/base/cast-return/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type

/**
* Ternary function returning a complex number.
Expand All @@ -93,7 +93,7 @@
* @param z - input value
* @returns result
*/
type WrappedTernary = ( x: any, y: any, z: any ) => ComplexLike;

Check warning on line 96 in lib/node_modules/@stdlib/complex/base/cast-return/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type

/**
* Quaternary function returning either a real or complex number.
Expand Down Expand Up @@ -187,22 +187,14 @@
*
* @example
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
* var realf = require( '@stdlib/complex/float32/real' );
* var imagf = require( '@stdlib/complex/float32/imag' );
* var randu = require( '@stdlib/random/base/randu' );
*
* var f = wrap( randu, 0, Complex64 );
*
* // ...
*
* var z = f();
* // returns <Complex64>
*
* var re = realf( z );
* // returns <number>
*
* var im = imagf( z );
* // returns <number>
* // e.g., returns <Complex64>[ <number>, <number> ]
*/
declare function wrap( fcn: Nullary, nargs: 0, ctor: Constructor ): WrappedNullary;

Expand All @@ -223,21 +215,13 @@
* @example
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
* var identityf = require( '@stdlib/number/float32/base/identity' );
* var realf = require( '@stdlib/complex/float32/real' );
* var imagf = require( '@stdlib/complex/float32/imag' );
*
* var f = wrap( identityf, 1, Complex64 );
*
* // ...
*
* var z = f( 3.0 );
* // returns <Complex64>
*
* var re = realf( z );
* // returns 3.0
*
* var im = imagf( z );
* // returns 0.0
* // returns <Complex64>[ 3.0, 0.0 ]
*/
declare function wrap( fcn: Unary, nargs: 1, ctor: Constructor ): WrappedUnary;

Expand All @@ -258,21 +242,13 @@
* @example
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
* var addf = require( '@stdlib/number/float32/base/add' );
* var realf = require( '@stdlib/complex/float32/real' );
* var imagf = require( '@stdlib/complex/float32/imag' );
*
* var f = wrap( addf, 2, Complex64 );
*
* // ...
*
* var z = f( 3.0, 4.0 );
* // returns <Complex64>
*
* var re = realf( z );
* // returns 7.0
*
* var im = imagf( z );
* // returns 0.0
* // returns <Complex64>[ 7.0, 0.0 ]
*/
declare function wrap( fcn: Binary, nargs: 2, ctor: Constructor ): WrappedBinary;

Expand All @@ -292,8 +268,6 @@
*
* @example
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
* var realf = require( '@stdlib/complex/float32/real' );
* var imagf = require( '@stdlib/complex/float32/imag' );
*
* function add( x, y, z ) {
* return x + y + z;
Expand All @@ -304,13 +278,7 @@
* // ...
*
* var z = f( 3.0, 4.0, 5.0 );
* // returns <Complex64>
*
* var re = realf( z );
* // returns 12.0
*
* var im = imagf( z );
* // returns 0.0
* // returns <Complex64>[ 12.0, 0.0 ]
*/
declare function wrap( fcn: Ternary, nargs: 3, ctor: Constructor ): WrappedTernary;

Expand All @@ -330,8 +298,6 @@
*
* @example
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
* var realf = require( '@stdlib/complex/float32/real' );
* var imagf = require( '@stdlib/complex/float32/imag' );
*
* function add( x, y, z, w ) {
* return x + y + z + w;
Expand All @@ -342,13 +308,7 @@
* // ...
*
* var z = f( 3.0, 4.0, 5.0, 6.0 );
* // returns <Complex64>
*
* var re = realf( z );
* // returns 18.0
*
* var im = imagf( z );
* // returns 0.0
* // returns <Complex64>[ 18.0, 0.0 ]
*/
declare function wrap( fcn: Quaternary, nargs: 4, ctor: Constructor ): WrappedQuaternary;

Expand All @@ -368,8 +328,6 @@
*
* @example
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
* var realf = require( '@stdlib/complex/float32/real' );
* var imagf = require( '@stdlib/complex/float32/imag' );
*
* function add( x, y, z, w, v ) {
* return x + y + z + w + v;
Expand All @@ -380,13 +338,7 @@
* // ...
*
* var z = f( 3.0, 4.0, 5.0, 6.0, 7.0 );
* // returns <Complex64>
*
* var re = realf( z );
* // returns 25.0
*
* var im = imagf( z );
* // returns 0.0
* // returns <Complex64>[ 25.0, 0.0 ]
*/
declare function wrap( fcn: Quinary, nargs: 5, ctor: Constructor ): WrappedQuinary;

Expand All @@ -406,8 +358,6 @@
*
* @example
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
* var realf = require( '@stdlib/complex/float32/real' );
* var imagf = require( '@stdlib/complex/float32/imag' );
*
* function add( x, y, z, w, v, t ) {
* return x + y + z + w + v + t;
Expand All @@ -418,13 +368,7 @@
* // ...
*
* var z = f( 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 );
* // returns <Complex64>
*
* var re = realf( z );
* // returns 33.0
*
* var im = imagf( z );
* // returns 0.0
* // returns <Complex64>[ 33.0, 0.0 ]
*/
declare function wrap( fcn: Nary, nargs: number, ctor: Constructor ): WrappedNary;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,15 @@

var Complex64 = require( '@stdlib/complex/float32/ctor' );
var addf = require( '@stdlib/number/float32/base/add' );
var realf = require( '@stdlib/complex/float32/real' );
var imagf = require( '@stdlib/complex/float32/imag' );
var castReturn = require( './../lib' );

var f = castReturn( addf, 2, Complex64 );

// ...

var z = f( 3.0, 4.0 );
// returns <Complex64>
// returns <Complex64>[ 7.0, 0.0]

var re = realf( z );
// returns 7.0

var im = imagf( z );
// returns 0.0

console.log( '%d + %di', re, im );
// => '7 + 0i'
console.log( z.toString() );
// => '7 + 0i'
10 changes: 2 additions & 8 deletions lib/node_modules/@stdlib/complex/base/cast-return/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

'use strict';

/**

Check failure on line 21 in lib/node_modules/@stdlib/complex/base/cast-return/lib/index.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

JSDoc comments should not have multiple subsequent blank lines
* Wrap a function and casts a function's return value to a complex number.
*
* @module @stdlib/complex/base/cast-return
Expand All @@ -26,22 +26,16 @@
* @example
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
* var addf = require( '@stdlib/number/float32/base/add' );
* var realf = require( '@stdlib/complex/float32/real' );
* var imagf = require( '@stdlib/complex/float32/imag' );
* var castReturn = require( '@stdlib/complex/base/cast-return' );
*
* var f = castReturn( addf, 2, Complex64 );

Check warning on line 31 in lib/node_modules/@stdlib/complex/base/cast-return/lib/index.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "addf"
*
* // ...
*
* var z = f( 3.0, 4.0 );
* // returns <Complex64>
* // returns <Complex64>[ 7.0, 0.0 ]
*
* var re = realf( z );
* // returns 7.0
*
* var im = imagf( z );
* // returns 0.0
*

Check failure on line 38 in lib/node_modules/@stdlib/complex/base/cast-return/lib/index.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Trailing spaces not allowed
*/

// MODULES //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,14 @@ var T = 'number';
* @example
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
* var addf = require( '@stdlib/number/float32/base/add' );
* var realf = require( '@stdlib/complex/float32/real' );
* var imagf = require( '@stdlib/complex/float32/imag' );
*
* var f = wrap( addf, 2, Complex64 );
*
* // ...
*
* var z = f( 3.0, 4.0 );
* // returns <Complex64>
* // returns <Complex64>[ 7.0, 0.0 ]
*
* var re = realf( z );
* // returns 7.0
*
* var im = imagf( z );
* // returns 0.0
*/
function wrap( fcn, nargs, ctor ) {
var fcns;
Expand Down
Loading