<commit_before># Licenses

> Resolve licenses.


<!-- <intro> -->

<!-- </intro> -->


<!-- <usage> -->

## Usage

``` javascript
var licenses = require( '/path/to/stdlib/tools/licenses/licenses' );
```

#### licenses( \[options\], clbk )

Reads installed package dependencies and extracts license information from `package.json` files. 

``` javascript
licenses( onResults );

function onResults( error, results ) {
    if ( error ) {
        throw error;
    }
    console.dir( results );
}
```

The function accepts the following `options`:

* __dir__: root directory from which to search for packages. Default: current working directory.
* __depth__: search depth. Default: `+infinity` (the entire dependency tree).
* __dev__: `boolean` indicating whether to include dev dependencies. Default: `true`.

By default, the function searches the entire dependency tree. To limit the search depth, set the `depth` option.

``` javascript
var opts = {
    'depth': 0 // search only top-level installed packages
};

licenses( opts, onResults );

function onResults( error, results ) {
    if ( error ) {
        throw error;
    }
    console.dir( results );
}
```

To exclude development dependencies, set the `dev` option to `false`.

``` javascript
var opts = {
    'dev': false
};

licenses( opts, onResults );

function onResults( error, results ) {
    if ( error ) {
        throw error;
    }
    console.dir( results );
}
```

<!-- </usage> -->


<!-- <examples> -->

<!-- ## Examples

``` javascript

``` -->

<!-- </examples> -->


<!-- <cli> -->

---

## CLI

<!-- <usage> -->

### Usage

``` bash
Usage: licenses [options]

Options:

  -h,    --help                      Print this message.
  -V,    --version                   Print the package version.
         --dir dirname               Root directory from which to search.
         --depth level               Search depth.
         --no-dev                    Exclude dev dependencies.
```

<!-- </usage> -->


<!-- <notes> -->

### Notes

* License results are printed to `stdout` as newline-delimited JSON.

<!-- </notes> -->


<!-- <examples> -->

### Examples

``` bash
$ DEBUG=* licenses
# => {"id":"...","parents":["..."],...,"licenses":{...}}
# => {"id":"...","parents":["..."],...,"licenses":{...}}
# => ...
```


<!-- </examples> -->

<!-- </cli> -->


<!-- <links> -->

<!-- </links> --><commit_msg>Add link<commit_after># Licenses

> Resolve licenses.


<!-- <intro> -->

<!-- </intro> -->


<!-- <usage> -->

## Usage

``` javascript
var licenses = require( '/path/to/stdlib/tools/licenses/licenses' );
```

#### licenses( \[options\], clbk )

Reads installed package dependencies and extracts license information from `package.json` files. 

``` javascript
licenses( onResults );

function onResults( error, results ) {
    if ( error ) {
        throw error;
    }
    console.dir( results );
}
```

The function accepts the following `options`:

* __dir__: root directory from which to search for packages. Default: current working directory.
* __depth__: search depth. Default: `+infinity` (the entire dependency tree).
* __dev__: `boolean` indicating whether to include dev dependencies. Default: `true`.

By default, the function searches the entire dependency tree. To limit the search depth, set the `depth` option.

``` javascript
var opts = {
    'depth': 0 // search only top-level installed packages
};

licenses( opts, onResults );

function onResults( error, results ) {
    if ( error ) {
        throw error;
    }
    console.dir( results );
}
```

To exclude development dependencies, set the `dev` option to `false`.

``` javascript
var opts = {
    'dev': false
};

licenses( opts, onResults );

function onResults( error, results ) {
    if ( error ) {
        throw error;
    }
    console.dir( results );
}
```

<!-- </usage> -->


<!-- <examples> -->

<!-- ## Examples

``` javascript

``` -->

<!-- </examples> -->


<!-- <cli> -->

---

## CLI

<!-- <usage> -->

### Usage

``` bash
Usage: licenses [options]

Options:

  -h,    --help                      Print this message.
  -V,    --version                   Print the package version.
         --dir dirname               Root directory from which to search.
         --depth level               Search depth.
         --no-dev                    Exclude dev dependencies.
```

<!-- </usage> -->


<!-- <notes> -->

### Notes

* License results are printed to `stdout` as newline-delimited JSON ([NDJSON][ndjson]).

<!-- </notes> -->


<!-- <examples> -->

### Examples

``` bash
$ DEBUG=* licenses
# => {"id":"...","parents":["..."],...,"licenses":{...}}
# => {"id":"...","parents":["..."],...,"licenses":{...}}
# => ...
```


<!-- </examples> -->

<!-- </cli> -->


<!-- <links> -->

[ndjson]: http://ndjson.org/

<!-- </links> -->
{'fraction_non_alphanumeric': 0.2002503128911139, 'fraction_numerical': 0.00041718815185648727, 'mean_word_length': 2.329861111111111, 'pattern_counts': {'":': 12, '<': 69, '<?xml version=': 0, '>': 77, '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': '2627650', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1368, 'n_words': 428}