# extend-arguments

> Allows extending of arguments object

Latest version **0.9.2** (published 2014-07-20) · 0 weekly downloads

## Install

```sh
npm install extend-arguments
pnpm add extend-arguments
yarn add extend-arguments
bun add extend-arguments
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.2 |
| Published | 2014-07-20 |
| First published | 2014-07-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | ginden |
| Keywords | proof-of-concept, arguments, extend |

## Links

- npm: https://www.npmjs.com/package/extend-arguments
- Repository: https://github.com/Ginden/extend-arguments-js
- npm.io page: https://npm.io/package/extend-arguments

## Recent versions

- 0.9.2 (latest) — 2014-07-20
- 0.9.0 — 2014-07-20

## README

# extendArguments.js

## Why?
Because I can. Just a proof of concept.

## How to install?

```bash
npm install extend-arguments
```

## How can I use this?

### Basic usage
```javascript
var extendArguments = require('extend-arguments');
extendArguments('foo', 'bar');

extendArguments('forEach', Array.prototype.forEach);
(function() {
    arguments.forEach(console.log.bind(console));
})('a','b', 'c')
// logs 'a', 'b', 'c'

({0: 1, length: 1}).forEach(console.log.bind(console));
// TypeError: (intermediate value).forEach is not a function

Object.prototype.forEach = function() {
    throw new Error('Just testing.');
}

({0: 1, length: 1}).forEach(console.log.bind(console)); // Error: Just testing

(function() {
    arguments.forEach(console.log.bind(console));
})('a','b', 'c') // logs 'a', 'b', 'c'

```

### Extend by object

#### Extend by literal

```javascript
extendArguments({
    forEach: Array.prototype.forEach,
    toArray: Array.prototype.slice
});
```


#### Extend by Array methods
```javascript
var methodsFromArray = {};
Object.getOwnPropertyNames(Array.prototype).forEach(function(el) {
    methodsFromArray[el] = Array.prototype[el];
});

extendArguments(
    methodsFromArray
);
```


## TODO:

### ArgumentsPrototype object

```javascript
ArgumentsPrototype.foo = 'bar';
(function() {
    return arguments.foo;
}); // bar
```
Requires ES6 Proxies.

## Compatibility:
Tested:
* Firefox 29
* Chromium 34
* Node.js 0.10.25

Should work:
* IE 9+
* Firefox 4+
* Chrome 5+

---
_Source: https://npm.io/package/extend-arguments · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
