
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
@stdlib/complex-base-wrap-function
Advanced tools
Wrap a function accepting complex number arguments to support providing both real and complex numbers.
We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.
The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.
When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.
To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
Wrap a function accepting complex number arguments to support providing both real and complex numbers.
npm install @stdlib/complex-base-wrap-function
var wrap = require( '@stdlib/complex-base-wrap-function' );
Returns a function which wraps a function accepting complex number arguments to support providing both real and complex numbers.
var Complex64 = require( '@stdlib/complex-float32' );
var caddf = require( '@stdlib/math-base-ops-caddf' );
var f = wrap( caddf, 2, Complex64 );
// returns <Function>
The function accepts the following arguments:
number
), then the input argument is a complex number. The returned function does not verify that non-numeric input arguments are, in fact, complex number objects. The returned function passes non-numeric input arguments to the wrapped function without modification.var Complex64 = require( '@stdlib/complex-float32' );
var caddf = require( '@stdlib/math-base-ops-caddf' );
var realf = require( '@stdlib/complex-realf' );
var imagf = require( '@stdlib/complex-imagf' );
var wrap = require( '@stdlib/complex-base-wrap-function' );
var f = wrap( caddf, 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
console.log( '%d + %di', re, im );
// => '7 + 0i'
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
See LICENSE.
Copyright © 2016-2023. The Stdlib Authors.
0.1.0 (2023-09-23)
<section class="features">9768c66
- update minimum TypeScript version32a2827
- update import paths for complex type defs9768c66
: update minimum TypeScript version to 4.1
9768c66
- feat: update minimum TypeScript version (by Philipp Burckhardt)32a2827
- fix: update import paths for complex type defs (by Athan Reines)A total of 2 people contributed to this release. Thank you to the following contributors:
FAQs
Wrap a function accepting complex number arguments to support providing both real and complex numbers.
We found that @stdlib/complex-base-wrap-function demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.