Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@stdlib/function-ctor
Advanced tools
Function constructor.
npm install @stdlib/function-ctor
var Function = require( '@stdlib/function-ctor' );
Returns a new function object.
var greet = new Function( 'name', 'return "Hello, "+name+"!"' );
var v = greet( 'Jane' );
// returns 'Hello, Jane!'
Argument names must be strings corresponding to valid JavaScript parameters (i.e., a plain identifier, or, in environments supporting such parameters, a rest parameter or destructured parameter, optionally with a default).
Function
objects with the Function
constructor is less efficient than declaring a function via a function expression or a function statement.Function
constructor can be invoked without the new
operator (using new
and not using new
both return a new Function
object).Function
constructor creates functions which execute in the global scope. Hence, created functions cannot access variables local to the scope in which functions were created.var Function = require( '@stdlib/function-ctor' );
var add = new Function( 'x', 'y', 'return x + y' );
var v = add( 1, 2 );
// returns 3
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-2022. The Stdlib Authors.
0.0.1 (2022-08-19)
No changes reported for this release.
</section> <!-- /.release -->FAQs
Function constructor.
We found that @stdlib/function-ctor 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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.