0.2.0 • Published 10 years ago

salvator v0.2.0

Weekly downloads
23
License
MIT
Repository
github
Last release
10 years ago

NPM version Build Status Dependency Status

Checks given filepath to exist, and if yes, returns safe version of filepath

Install

$ npm install --save salvator

Usage

var salvator = require('salvator');

salvator.safe('/path/to/my/file.js')
    .then(function(result) {
        // result is a safe to write filepath like a
        // /path/to/my/file(1).js
    });

API

salvator.safe(filepath: string, options: Object) : Promise
options.format

Type: string Default: "${dirname}/${filename}(${fix}).${extname}"

Template for a new path iterator.

options.counter

Type: Function(fix: Any) Default: [incremental function]

Where fix is a result from previous call, or undefined.

options.limit

Type: number Default: 999

Limit of iterations.

options.exclude

Type: Array
Default: []

Contains a list of "excluded" filepaths that will not be returned by the module in any case.

License

MIT © Sergey Kamrdin

0.2.0

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago