<commit_before># js-task-path

[![Recent Version][npm-badge]][npm-url]
[![Travis CI - Build Status][travis-badge]][travis-url]
[![Coveralls - Code Coverage Status][cov-badge]][cov-url]
[![David - Dependencies][dep-badge]][dep-url]
[![David - DevDependencies][dev-dep-badge]][dev-dep-url]
[![Doclets][doclets-badge]][doclets-url]
[![Gitter - Repository Chat][chat-badge]][chat-url]

## Synopsis

A helper class to manage **task-**, **build-** and **deployment-related** paths more easily throughout 
the whole project. It provides an intuitive method to handle **path shortcuts for custom paths**.

- Written in **ES6**
- **Node-only**.

## Install

```
npm install js-task-path
```

## Usage

For additional examples,
check the **[tests folder](https://github.com/jsstd/js-task-path/tree/master/tests)**

```javascript
const path = require('js-task-path');

// after require, you can use path right away without instantiation, since it's a singleton

// add general/custom paths
path.add('dist',  '<root>/dist');
path.add('src',   '<root>/src');
path.add('doc',   '<root>/doc');
path.add('tasks', '<root>/tasks');
path.add('tests', '<root>/tests');

// use previously given, custom paths via token
path.add('build-tasks', '<tasks>/build/*.js');

// add individual files
path.add('source-file', '<src>/src.js');
path.add('dist-file',   '<dist>/dist.js');

// get paths by name
path.get('source-file');
path.get('dist-file');
```

```javascript
// example, when using gulp
gulp.task('build-source', function() {
    return gulp
        .src(path.get('src'))
        .pipe(
            gulp.dest(path.get('dist')
        ));
});
```<commit_msg>Add more usage examples<commit_after># js-task-path

[![Recent Version][npm-badge]][npm-url]
[![Travis CI - Build Status][travis-badge]][travis-url]
[![Coveralls - Code Coverage Status][cov-badge]][cov-url]
[![David - Dependencies][dep-badge]][dep-url]
[![David - DevDependencies][dev-dep-badge]][dev-dep-url]
[![Doclets][doclets-badge]][doclets-url]
[![Gitter - Repository Chat][chat-badge]][chat-url]

## Synopsis

A helper class to manage **task-**, **build-** and **deployment-related** paths more easily throughout 
the whole project. It provides an intuitive method to handle **path shortcuts for custom paths**.

- Written in **ES6**
- **Node-only**.

## Install

```
npm install js-task-path
```

## Usage

For additional examples,
check the **[tests folder](https://github.com/jsstd/js-task-path/tree/master/tests)**

```javascript
const path = require('js-task-path');

// after require, you can use path right away without instantiation, since it's a singleton

// set custom paths
// '<root>' is present by default and its value is automatically determined and set to the package's root
path.set('dist', '<root>/dist');
path.set('src',  '<root>/src');
path.set('doc',  '<root>/doc');

// or use chaining
path.set('lib',      '<root>/lib')
    .set('scripts',  '<root>/scripts')
    .set('examples', '<root>/examples');
  
// or use the shorthand versions
path('tasks', '<root>/tasks');
path({
    tests : '<root>/tests',
    vars  : '<root>/vars'
});
    
// when setting paths, use previous paths with tokens
// also works with every form of path settings
path.set('test-cases', '<tests>/cases');

/*
default tokens (with 'root'):

'<root>'
'<<root>>'
'@root@'
'{@root@}'
'{%root%}'
'{{root}}'
*/

// use paths
path.get('dist'); // will be '<root>/dist', where <root> will be auto-resolved to package root (e.g.: '/vagrant/dist')

// or the shorthand version
path('dist');

// if the path constructed via different layers (e.g.: '<tests>/cases', where <tests> too is '<root>/tests'),
// the full path will be resolved.
path.get('test-cases'); // will be e.g.: '/vagrant/tests/cases'
```
{'fraction_non_alphanumeric': 0.20588235294117646, 'fraction_numerical': 0.0005347593582887701, 'mean_word_length': 4.269014084507043, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, 'https://': 2, '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': '4167169', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1237, 'n_words': 337}