<commit_before>default-parameter.js
====================

A experimental default values for function parameters in Javascript, that just uses arguments.callee and arguments.caller

This is just an *experimental* project, that shows how `arguments.callee` and `arguments.caller`
could be used in real world applications to make programmers life easier.

Frankly speaking I would add an parameter in the arguments that allows you to get the `context`
of the function, this way we could create very powerfull stuffs like this project.

The ideia is to have a function that goes inside any function, and you can easy create
default values for the function parameters.

Example
-------

```
function abc(a, b, c){
  if(arguments.length < arguments.callee.length){
    return defaults.call(this, 'a',{e: 1, f: 2, g: 3},'c');
  }
  return [a,b,c];
}
```

Tests:

```
abc();
// ["a", { e:1, f:2, g:3 }, "c"]

abc('d');<commit_msg>Added more examples of use<commit_after>default-parameter.js
====================

A experimental default values for function parameters in Javascript, that just uses arguments.callee and arguments.caller

This is just an *experimental* project, that shows how `arguments.callee` and `arguments.caller`
could be used in real world applications to make programmers life easier.

Frankly speaking I would add an parameter in the arguments that allows you to get the `context`
of the function, this way we could create very powerfull stuffs like this project.

The ideia is to have a function that goes inside any function, and you can easy create
default values for the function parameters.

Usage
-----

To use you need to wrap 3 lines code in any function:

```
if(arguments.length < arguments.callee.length){
  return defaults.call(this, /* default values, separeted by comma */);
}
```

Or you can use an array as second parameter using `apply` instead `call`.

```
if(arguments.length < arguments.callee.length){
  return defaults.apply(this, /* default values in array [arg1, arg2, arg3...] */);
}
```

Example
-------

```
function abc(a, b, c){
  if(arguments.length < arguments.callee.length){
    return defaults.call(this, 'a',{e: 1, f: 2, g: 3},'c');
  }
  return [a,b,c];
}
```

Tests:

```
abc();
// ["a", { e:1, f:2, g:3 }, "c"]

abc('d');
{'fraction_non_alphanumeric': 0.13676341248900617, 'fraction_numerical': 0.007036059806508356, 'mean_word_length': 4.241935483870968, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4452902', 'n_tokens_mistral': 693, 'n_tokens_neox': 663, 'n_words': 287}