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

arguments-to-array

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arguments-to-array

Make your function arguments into an actual array

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

arguments-to-array

Make your function arguments into an actual array

node npm Travis Gemnasium Coveralls

installation:

⇒ npm install arguments-to-array

arguments:

The arguments object is an Array-like object corresponding to the arguments passed to a function.

The arguments object is not an Array. It is similar to an Array, but does not have any Array properties except length. For example, it does not have the pop method. However it can be converted to a real Array:

var args = Array.prototype.slice.call(arguments);

From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments

arguments is similar to an Array due to the indexing of its values. Like an array is indexed, keys in arguments are integers with their order zero-based.

why this module:

This module (or rather this repo) aims to hold some curated information on arguments. It is helpful for JavaScript beginners who wonder why the heck arguments.forEach() is not working! Plus it is easier to remember:

var argumentsToArray = require("arguments-to-array");

function example() {
    var array = argumentsToArray(arguments);
}

Also, see this discussion on one-line modules.

possible alternatives:

lodash

If you are using lodash you need not add this module to your dependencies list. See lodash docs on _.toArray

var _ = require("lodash");

function example() {
    var array = _.toArray(arguments);
}

articles on this topic:

credits:

license:

Source code is licensed under the The MIT License (MIT)

Copyright (c) 2015-2016 GochoMugo mugo@forfuture.co.ke

Keywords

FAQs

Package last updated on 18 Feb 2016

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