Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stdlib/function-ctor

Package Overview
Dependencies
Maintainers
4
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/function-ctor - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"name": "@stdlib/function-ctor",
"version": "0.0.1",
"version": "0.0.2",
"description": "Function constructor.",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

@@ -51,4 +51,2 @@ <!--

<!-- eslint-disable stdlib/no-redeclare -->
```javascript

@@ -62,4 +60,2 @@ var Function = require( '@stdlib/function-ctor' );

<!-- eslint-disable stdlib/no-redeclare -->
```javascript

@@ -74,2 +70,114 @@ var greet = new Function( 'name', 'return "Hello, "+name+"!"' );

* * *
### Properties
<a name="prop-length"></a>
#### Function.prototype.length
A number representing the number of arguments expected by the function.
```javascript
var greet = new Function( 'name', 'return "Hello, "+name+"!"' );
var v = greet.length;
// returns 1
```
<a name="prop-name"></a>
#### Function.prototype.name
**Read-only** property representing the name of the function.
```javascript
function greet( name ) {
return 'Hello, '+name+'!';
}
v = greet.name;
// returns 'greet'
// Functions created with the Function constructor are anonymous:
var fcn = new Function( 'name', 'return "Hello, "+name+"!"' );
var v = fcn.name;
// returns 'anonymous'
```
<a name="prop-prototype"></a>
#### Function.prototype.prototype
**Read-only** property representing the prototype of the function.
```javascript
function greet( name ) {
return 'Hello, '+name+'!';
}
var proto = greet.prototype;
// returns {}
```
* * *
### Methods
<a name="method-apply"></a>
#### Function.prototype.apply( thisArg, args )
Calls the specified function witht he given `this` argument and arguments provided as an array-like object.
```javascript
function add( x, y ) {
return x + y;
}
var v = add.apply( null, [ 1, 2 ] );
// returns 3
```
<a name="method-bind"></a>
#### Function.prototype.bind( thisArg\[, arg1\[, arg2\[, ...]]] )
Returns a new function which invokes the original function with the given `this` value and arguments.
```javascript
functiona add( x, y ) {
return x + y;
}
var add1 = add.bind( null, 1 );
var v = add1( 2 );
// returns 3
```
<a name="method-call"></a>
#### Function.prototype.call( thisArg\[, arg1\[, arg2\[, ...]]] )
Calls the specified function with the given `this` value and arguments.
```javascript
function add( x, y ) {
return x + y;
}
var v = add.call( null, 1, 2 );
// returns 3
```
<a name="method-to-string"></a>
#### Function.prototype.toString()
Returns a string representing the function.
```javascript
function add( x, y ) {
return x + y;
}
var v = add.toString();
// returns 'function add( x, y ) {\n return x + y;\n}'
```
</section>

@@ -102,4 +210,2 @@

<!-- eslint-disable stdlib/no-redeclare -->
```javascript

@@ -173,4 +279,4 @@ var Function = require( '@stdlib/function-ctor' );

[test-image]: https://github.com/stdlib-js/function-ctor/actions/workflows/test.yml/badge.svg?branch=v0.0.1
[test-url]: https://github.com/stdlib-js/function-ctor/actions/workflows/test.yml?query=branch:v0.0.1
[test-image]: https://github.com/stdlib-js/function-ctor/actions/workflows/test.yml/badge.svg?branch=v0.0.2
[test-url]: https://github.com/stdlib-js/function-ctor/actions/workflows/test.yml?query=branch:v0.0.2

@@ -177,0 +283,0 @@ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/function-ctor/main.svg

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc