<commit_before># pathmap.js

Rake's [#pathmap](http://rake.rubyforge.org/classes/String.html#M000017) method
for JavaScript. Think of it like `sprintf` for paths.

## Usage

`pathmap` accepts a path and a pathmap spec and returns a formatted string.

``` js
var pathmap = require('pathmap');

pathmap('a/b/c/d/file.txt', 'rm %f'); // => 'rm file.txt'
pathmap('file.coffee', 'mv %p %X.js'); // => 'mv file.coffee file.js'
```

The following patterns are supported:

- `%p` - The complete path.
- `%f` - The base file name of the path, with its file extension, but without any directories.
- `%n` - The file name of the path without its file extension.
- `%d` - The directory list of the path.
- `%x` - The file extension of the path. An empty string if there is no extension.
- `%X` - Everything but the file extension.
- `%s` - The file separator. This can be configured by setting `pathmap.sep`.
- `%%` - A percent sign.

The `%d` pattern supports a `count` argument to specify the number of directories to return from either side.

``` js
pathmap('a/b/c/d/file.txt', '%2d'); // => 'a/b'
pathmap('a/b/c/d/file.txt', '%-2d'); // => 'c/d'
```

`%p`, `%f`, `%n`, `%d`, `%x` and `%X` support a replacement argument that can be used to replace portions of the resulting string. The pattern looks like "{old,new}".

``` js
pathmap('file.md', '%X%{md,mdown}x'); // => 'file.mdown'
```

## License

[MIT License][LICENSE]

[LICENSE]: https://github.com/jeremyruppel/pathmap/blob/master/LICENSE<commit_msg>Add npm and travis badges to readme<commit_after># pathmap.js

Rake's [#pathmap](http://rake.rubyforge.org/classes/String.html#M000017) method
for JavaScript. Think of it like `sprintf` for paths.

> [![NPM version][npm-badge]][npm]
> [![Build Status][travis-badge]][travis-ci]

## Usage

`pathmap` accepts a path and a pathmap spec and returns a formatted string.

``` js
var pathmap = require('pathmap');

pathmap('a/b/c/d/file.txt', 'rm %f'); // => 'rm file.txt'
pathmap('file.coffee', 'mv %p %X.js'); // => 'mv file.coffee file.js'
```

The following patterns are supported:

- `%p` - The complete path.
- `%f` - The base file name of the path, with its file extension, but without any directories.
- `%n` - The file name of the path without its file extension.
- `%d` - The directory list of the path.
- `%x` - The file extension of the path. An empty string if there is no extension.
- `%X` - Everything but the file extension.
- `%s` - The file separator. This can be configured by setting `pathmap.sep`.
- `%%` - A percent sign.

The `%d` pattern supports a `count` argument to specify the number of directories to return from either side.

``` js
pathmap('a/b/c/d/file.txt', '%2d'); // => 'a/b'
pathmap('a/b/c/d/file.txt', '%-2d'); // => 'c/d'
```

`%p`, `%f`, `%n`, `%d`, `%x` and `%X` support a replacement argument that can be used to replace portions of the resulting string. The pattern looks like "{old,new}".

``` js
pathmap('file.md', '%X%{md,mdown}x'); // => 'file.mdown'
```

## License

[MIT License][LICENSE]

[npm]: http://badge.fury.io/js/pathmap
[npm-badge]: https://badge.fury.io/js/pathmap.svg
[travis-ci]: https://travis-ci.org/jeremyruppel/pathmap
[travis-badge]: https://travis-ci.org/jeremyruppel/pathmap.svg?branch=master
[LICENSE]: https://github.com/jeremyruppel/pathmap/blob/master/LICENSE
{'fraction_non_alphanumeric': 0.18247515808491419, 'fraction_numerical': 0.004817825956037338, 'mean_word_length': 3.8425655976676385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 5, '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': '1705873', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1177, 'n_words': 383}