<commit_before># Summarize

> Perform a static [summary analysis][@stdlib/_tools/static-analysis/js/program-incrsummary] on a list of JavaScript files.

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- Package usage documentation. -->

<section class="usage">

## Usage

```javascript
var analyze = require( '@stdlib/_tools/static-analysis/js/summarize-file-list' );
```

<a name="analyze-async"></a>

#### analyze( files, \[options,] clbk )

Performs a static [summary analysis][@stdlib/_tools/static-analysis/js/program-incrsummary] on a list of JavaScript files.

```javascript
var files = [ './beep.js', './boop.js' ];

analyze( files, clbk );

function clbk( error, results ) {
    if ( error ) {
        throw error;
    }
    console.log( JSON.stringify( results ) );
}
```

The function accepts the following `options`:

-   **cumulative**: `boolean` indicating whether to perform a cumulative analysis. Default: `true`.

By default, the function performs a cumulative static [summary analysis][@stdlib/_tools/static-analysis/js/program-incrsummary]. To return a separate [program summary][@stdlib/_tools/static-analysis/js/program-summary] for each file in `files`, set the `cumulative` option to `false`.

```javascript
var files = [ './beep.js', './boop.js' ];

var opts = {
    'cumulative': false
};
analyze( files, opts, clbk );

function clbk( error, results ) {
    if ( error ) {
        throw error;
    }
    console.log( JSON.stringify( results ) );
}
```

#### analyze.sync( files\[, options] )

Synchronously performs a static [summary analysis][@stdlib/_tools/static-analysis/js/program-incrsummary] on a list of JavaScript files.

```javascript
var files = [ './beep.js', './boop.js' ];

var results = analyze( files );
if ( results instanceof Error ) {
    throw results;
}
console.log( JSON.stringify( results ) );
```

The function accepts the same `options` as [`analyze()`](#analyze-async) above.

</section>

<!-- /.usage -->

<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

## Notes

-   File paths are resolved relative to the current working directory of the calling process.

</section>

<!-- /.notes -->

<!-- Package usage examples. -->

<section class="examples">

## Examples

```javascript
var join = require( 'path' ).join;
var analyze = require( '@stdlib/_tools/static-analysis/js/summarize-file-list' );

var files = [
    join( __dirname, 'examples', 'index.js' ),
    join( __dirname, 'lib', 'index.js' ),
    join( __dirname, 'lib', 'main.js' ),
    join( __dirname, 'lib', 'sync.js' ),
    join( __dirname, 'test', 'test.js' ),
    join( __dirname, 'bin', 'cli' )
];

analyze( files, clbk );

function clbk( error, results ) {
    if ( error ) {
        return console.error( 'Error: %s', error.message );
    }
    console.log( JSON.stringify( results ) );
}
```

</section>

<!-- /.examples -->

<!-- Section for describing a command-line interface. -->

* * *

<section class="cli">

## CLI

<!-- CLI usage documentation. -->

<section class="usage">

### Usage

```text
Usage: js-summarize-file-list [options] [<file> <file> ...]

Options:

  -h,  --help            Print this message.
  -V,  --version         Print the package version.
       --split sep       Separator used to split stdin data. Default: /\\r?\\n/.
       --no-cumulative   Generate separate program summaries and print results
                         as newline-delimited JSON (NDJSON).
```

</section>

<!-- /.usage -->

<!-- CLI usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

### Notes

-   If cumulative analysis is disabled, the CLI prints a [program summary][@stdlib/_tools/static-analysis/js/program-summary] for each input file as [newline-delimited JSON][ndjson] (NDJSON).

</section>

<!-- /.notes -->

<!-- CLI usage examples. -->

<section class="examples">

### Examples

```bash
$ js-summarize-file-list ./examples/index.js
{...}
```

To use as a [standard stream][standard-streams],

```bash
$ echo -n './examples/index.js\n./lib/index.js\n' | js-summarize-file-list
{...}
```

To generate a separate [program summary][@stdlib/_tools/static-analysis/js/program-summary] for each input file, set the `no-cumulative` flag.

```bash
$ echo -n './examples/index.js\n./lib/index.js\n' | js-summarize-file-list --no-cumulative
{...}
{...}
```

</section>

<!-- /.examples -->

</section>

<!-- /.cli -->

<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

</section>

<!-- /.references -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

[@stdlib/_tools/static-analysis/js/program-incrsummary]: https://github.com/stdlib-js/stdlib

[@stdlib/_tools/static-analysis/js/program-summary]: https://github.com/stdlib-js/stdlib

[ndjson]: http://specs.frictionlessdata.io/ndjson/

[standard-streams]: https://en.wikipedia.org/wiki/Standard_streams

</section>

<!-- /.links -->
<commit_msg>Fix bash examples<commit_after># Summarize

> Perform a static [summary analysis][@stdlib/_tools/static-analysis/js/program-incrsummary] on a list of JavaScript files.

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- Package usage documentation. -->

<section class="usage">

## Usage

```javascript
var analyze = require( '@stdlib/_tools/static-analysis/js/summarize-file-list' );
```

<a name="analyze-async"></a>

#### analyze( files, \[options,] clbk )

Performs a static [summary analysis][@stdlib/_tools/static-analysis/js/program-incrsummary] on a list of JavaScript files.

```javascript
var files = [ './beep.js', './boop.js' ];

analyze( files, clbk );

function clbk( error, results ) {
    if ( error ) {
        throw error;
    }
    console.log( JSON.stringify( results ) );
}
```

The function accepts the following `options`:

-   **cumulative**: `boolean` indicating whether to perform a cumulative analysis. Default: `true`.

By default, the function performs a cumulative static [summary analysis][@stdlib/_tools/static-analysis/js/program-incrsummary]. To return a separate [program summary][@stdlib/_tools/static-analysis/js/program-summary] for each file in `files`, set the `cumulative` option to `false`.

```javascript
var files = [ './beep.js', './boop.js' ];

var opts = {
    'cumulative': false
};
analyze( files, opts, clbk );

function clbk( error, results ) {
    if ( error ) {
        throw error;
    }
    console.log( JSON.stringify( results ) );
}
```

#### analyze.sync( files\[, options] )

Synchronously performs a static [summary analysis][@stdlib/_tools/static-analysis/js/program-incrsummary] on a list of JavaScript files.

```javascript
var files = [ './beep.js', './boop.js' ];

var results = analyze( files );
if ( results instanceof Error ) {
    throw results;
}
console.log( JSON.stringify( results ) );
```

The function accepts the same `options` as [`analyze()`](#analyze-async) above.

</section>

<!-- /.usage -->

<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

## Notes

-   File paths are resolved relative to the current working directory of the calling process.

</section>

<!-- /.notes -->

<!-- Package usage examples. -->

<section class="examples">

## Examples

```javascript
var join = require( 'path' ).join;
var analyze = require( '@stdlib/_tools/static-analysis/js/summarize-file-list' );

var files = [
    join( __dirname, 'examples', 'index.js' ),
    join( __dirname, 'lib', 'index.js' ),
    join( __dirname, 'lib', 'main.js' ),
    join( __dirname, 'lib', 'sync.js' ),
    join( __dirname, 'test', 'test.js' ),
    join( __dirname, 'bin', 'cli' )
];

analyze( files, clbk );

function clbk( error, results ) {
    if ( error ) {
        return console.error( 'Error: %s', error.message );
    }
    console.log( JSON.stringify( results ) );
}
```

</section>

<!-- /.examples -->

<!-- Section for describing a command-line interface. -->

* * *

<section class="cli">

## CLI

<!-- CLI usage documentation. -->

<section class="usage">

### Usage

```text
Usage: js-summarize-file-list [options] [<file> <file> ...]

Options:

  -h,  --help            Print this message.
  -V,  --version         Print the package version.
       --split sep       Separator used to split stdin data. Default: /\\r?\\n/.
       --no-cumulative   Generate separate program summaries and print results
                         as newline-delimited JSON (NDJSON).
```

</section>

<!-- /.usage -->

<!-- CLI usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

### Notes

-   If cumulative analysis is disabled, the CLI prints a [program summary][@stdlib/_tools/static-analysis/js/program-summary] for each input file as [newline-delimited JSON][ndjson] (NDJSON).

</section>

<!-- /.notes -->

<!-- CLI usage examples. -->

<section class="examples">

### Examples

```bash
$ js-summarize-file-list ./examples/index.js
{...}
```

To use as a [standard stream][standard-streams],

```bash
$ echo -n $'./examples/index.js\n./lib/index.js\n' | js-summarize-file-list
{...}
```

To generate a separate [program summary][@stdlib/_tools/static-analysis/js/program-summary] for each input file, set the `no-cumulative` flag.

```bash
$ echo -n $'./examples/index.js\n./lib/index.js\n' | js-summarize-file-list --no-cumulative
{...}
{...}
```

</section>

<!-- /.examples -->

</section>

<!-- /.cli -->

<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

</section>

<!-- /.references -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

[@stdlib/_tools/static-analysis/js/program-incrsummary]: https://github.com/stdlib-js/stdlib

[@stdlib/_tools/static-analysis/js/program-summary]: https://github.com/stdlib-js/stdlib

[ndjson]: http://specs.frictionlessdata.io/ndjson/

[standard-streams]: https://en.wikipedia.org/wiki/Standard_streams

</section>

<!-- /.links -->

{'fraction_non_alphanumeric': 0.17148572467721404, 'fraction_numerical': 0.0, 'mean_word_length': 3.318413820180605, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 93, 'https://': 6, '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': '4630491', 'n_tokens_mistral': 3510, 'n_tokens_neox': 3336, 'n_words': 1030}