chance-path
v1.0.2
Published
A Chance.js mixin to generate paths.
Maintainers
Readme
chance-path 
A Chance.js mixin to generate paths.
Install
NPM
$ npm i chance-pathYarn
$ yarn add chance-pathUsage
import Chance from 'chance';
import path from 'chance-path';
const chance = new Chance();
chance.mixin({
path
});
chance.path();By default, chance-path will return a randomly generated path.
Example: some/random/path/to/something/somewhere/some.file
Options
Below is a list of available configuration options that you can pass into chance-path.
chance.path({
// options
});depth
Specifies how deep the path is.
For example, chance.path({depth: 4}) would produce something like path/depth/of/four/random.random.
Defaults to
chance.d6().
ext
Specifies what the file extension is.
For example, chance.path({ext: '.custom'}) would produce something like random/random/random.custom.
Defaults to
chance.word().
name
Specifies what the file name is.
For example, chance.path({name: 'custom'}) would produce something like random/random/custom.random.
Defaults to
chance.word().
root
Specifies if the path should be a root path.
For example, chance.path({root: true}) would produce something like /random/random/random.random.
Defaults to
chance.bool().
License
MIT © Michael Novotny
