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

very-fast-args

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

very-fast-args

A very fast way to convert arguments into array.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Very fast way of converting "arguments" into array.

This module does the same than fast-args, the only difference is that you can call this with apply.

Using function.apply(null, arguments) works on the optimizing compiler while using function(arguments) generates a leaks of the arguments object and prevent optimizations.

This module uses rest parameters if supported by the javascript engine.

Installation

npm i --save very-fast-args

Usage


const fargs = require('very-fast-args');

function myFunc() {
  const args = fargs.apply(null, arguments);
  //do something with args.
}

Always use fargs.apply(null, arguments) and do not use fargs(arguments).

Test about optimization

You can test the behavior of the compiler as follows:

» node --trace-deopt --trace-opt bench/simple.js | grep arguments
» node --trace-deopt --trace-opt bench/simple-with-fa.js | grep arguments
[disabled Crankshaft for 0x384b6486d409 <SharedFunctionInfo withVeryFastArgs>, reason: Bad value context for arguments value]

License

This project is licensed under the MIT license. See the LICENSE file for more info.

FAQs

Package last updated on 31 Mar 2017

Did you know?

Socket

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.

Install

Related posts

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