🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

chance-path

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chance-path

A Chance.js mixin to generate paths.

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
9
28.57%
Maintainers
1
Weekly downloads
 
Created
Source

chance-path Build Status

A Chance.js mixin to generate paths.

Install

NPM

$ npm i chance-path

Yarn

$ yarn add chance-path

Usage

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

Keywords

chance

FAQs

Package last updated on 01 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts